Merge pull request #399 from bluewave-labs/fix/mjml-security

Moved to alpha versin of mjml because of security vulnerabilities
This commit is contained in:
Alexander Holliday authored and GitHub committed 2024-07-20 19:33:27 -07:00
commit 6410dcde6e
4 files changed
+1954 -1685

No files matched your search

+1 -1
View File
@@ -85,7 +85,7 @@ const startApp = async () => {
app.use("/api/v1/mail", async (req, res) => { app.use("/api/v1/mail", async (req, res) => {
try { try {
const id = await req.emailSerivce.buildAndSendEmail( const id = await req.emailService.buildAndSendEmail(
"welcomeEmailTemplate", "welcomeEmailTemplate",
{ {
name: "Alex", name: "Alex",
+1950 -1681
View File
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -23,7 +23,7 @@
"joi": "^17.13.1", "joi": "^17.13.1",
"jsonwebtoken": "9.0.2", "jsonwebtoken": "9.0.2",
"mailersend": "^2.2.0", "mailersend": "^2.2.0",
"mjml": "^1.3.4", "mjml": "^5.0.0-alpha.4",
"mongoose": "^8.3.3", "mongoose": "^8.3.3",
"multer": "1.4.5-lts.1", "multer": "1.4.5-lts.1",
"nodemailer": "^6.9.14", "nodemailer": "^6.9.14",
+2 -2
View File
@@ -2,7 +2,7 @@ const fs = require("fs");
const path = require("path"); const path = require("path");
const nodemailer = require("nodemailer"); const nodemailer = require("nodemailer");
const { compile } = require("handlebars"); const { compile } = require("handlebars");
const { mjml2html } = require("mjml"); const mjml2html = require("mjml");
/** /**
* Represents an email service that can load templates, build, and send emails. * Represents an email service that can load templates, build, and send emails.
@@ -68,7 +68,7 @@ class EmailService {
buildAndSendEmail = async (template, context, to, subject) => { buildAndSendEmail = async (template, context, to, subject) => {
const buildHtml = (template, context) => { const buildHtml = (template, context) => {
const mjml = this.templateLookup[template](context); const mjml = this.templateLookup[template](context);
const html = mjml2html(mjml); const html = mjml2html(mjml).html;
return html; return html;
}; };