From be6ec894e39ad9215352cda3743792321cc4a893 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Wed, 15 Jul 2020 13:25:18 -0700 Subject: [PATCH] Fixed notifications that had html codes. --- meshuser.js | 2 +- views/default.handlebars | 3 +-- webserver.js | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/meshuser.js b/meshuser.js index 54820192..748cc461 100644 --- a/meshuser.js +++ b/meshuser.js @@ -1387,7 +1387,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use db.GetUserWithVerifiedEmail(domain.id, command.email, function (err, docs) { if ((docs != null) && (docs.length > 0)) { // Notify the duplicate email error - try { ws.send(JSON.stringify({ action: 'msg', type: 'notify', title: 'Account Settings', id: Math.random(), tag: 'ServerNotify', value: 'Failed to change email address, another account already using: ' + EscapeHtml(command.email) + '.' })); } catch (ex) { } + try { ws.send(JSON.stringify({ action: 'msg', type: 'notify', title: 'Account Settings', id: Math.random(), tag: 'ServerNotify', value: 'Failed to change email address, another account already using: ' + command.email + '.' })); } catch (ex) { } } else { // Update the user's email var oldemail = user.email; diff --git a/views/default.handlebars b/views/default.handlebars index 9383a721..d06b118e 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -1881,8 +1881,7 @@ // Check if none or at least 2 factors are enabled. if ((backupCodesWarningDone == false) && (authFactorCount == 1)) { - var n = { text: "Please add two-factor backup codes. If the current factor is lost, there is not way to recover this account.", title: "Two factor authentication" }; - addNotification(n); + addNotification({ text: "Please add two-factor backup codes. If the current factor is lost, there is not way to recover this account.", title: "Two factor authentication" }); backupCodesWarningDone = true; } diff --git a/webserver.js b/webserver.js index bdab9996..0afab7f2 100644 --- a/webserver.js +++ b/webserver.js @@ -1552,7 +1552,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) { render(req, res, getRenderPage('message', req, domain), getRenderArgs({ titleid: 1, msgid: 6, domainurl: encodeURIComponent(domain.url).replace(/'/g, '%27'), arg1: encodeURIComponent(user.email).replace(/'/g, '%27'), arg2: encodeURIComponent(user.name).replace(/'/g, '%27') }, req, domain)); // Send a notification - obj.parent.DispatchEvent([user._id], obj, { action: 'notify', value: 'Email verified:
' + EscapeHtml(user.email) + '.', nolog: 1, id: Math.random() }); + obj.parent.DispatchEvent([user._id], obj, { action: 'notify', title: 'Email verified', value: user.email, nolog: 1, id: Math.random() }); // Send to authlog if (obj.parent.authlog) { obj.parent.authLog('https', 'Verified email address ' + user.email + ' for user ' + user.name); }