Skip to content

Commit eed2cd7

Browse files
committed
markdown to markup in email description, backend
1 parent a5a8b2f commit eed2cd7

File tree

3 files changed

+1058
-0
lines changed

3 files changed

+1058
-0
lines changed

Backend/controllers/emailTemplates.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
const marked = require('marked')
2+
const createDomPurify = require('dompurify')
3+
const { JSDOM } = require('jsdom')
4+
const dompurify = createDomPurify(new JSDOM().window)
5+
6+
17
const otpTemplate = (user, otp) => {
28
return `<body>
39
<div>
@@ -41,6 +47,7 @@ const otpTemplate = (user, otp) => {
4147
};
4248

4349
const announceall = (event, date, image, description, url) => {
50+
description = dompurify.sanitize(marked.parse(description))
4451
return ` <body>
4552
<div>
4653
Dear student, AECCC is going to host <b>${event}</b> on ${date}.

0 commit comments

Comments
 (0)