From ca690c7a7ef80de398eabefce1273a51a1a8d195 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Tue, 18 Apr 2023 20:56:05 +0100 Subject: [PATCH] Add html-minifier for outgoing email Signed-off-by: Fred Boniface --- src/utils/auth.utils.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/utils/auth.utils.js b/src/utils/auth.utils.js index 0864137..52b67bd 100644 --- a/src/utils/auth.utils.js +++ b/src/utils/auth.utils.js @@ -2,6 +2,7 @@ const log = require('../utils/log.utils'); const crypto = require('crypto') const db = require('../services/dbAccess.services'); const fs = require('fs/promises') +const minify = require('html-minifier').minify; // Checks users registration key against issued keys async function isAuthed(uuid) { // Needs testing @@ -32,13 +33,16 @@ async function generateKey() { // Needs testing & moving to 'register.utils' async function generateConfirmationEmail(eml, uuid) { try { - let htmlTpl = fs.readFile('mail-templates/register.html', 'utf-8'); + let htmlTpl = await fs.readFile('mail-templates/register.html', 'utf-8'); + let minify = await minify(((htmlTpl).replace(/>>ACCESSCODE<>ACCESSCODE<>ACCESSCODE<