From 83c9c74294a14a4ad94da4e53e77e84496697a64 Mon Sep 17 00:00:00 2001 From: Rodrigo Nascimento Date: Sat, 9 May 2020 15:22:57 -0300 Subject: [PATCH] Remove unnecessary setting redefinition --- app/mailer/server/api.js | 2 +- server/methods/registerUser.js | 12 ------------ 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/app/mailer/server/api.js b/app/mailer/server/api.js index 45c7f10030f3..38bb11418273 100644 --- a/app/mailer/server/api.js +++ b/app/mailer/server/api.js @@ -23,7 +23,7 @@ settings.get('Language', (key, value) => { lng = value || 'en'; }); -export const replacekey = (str, key, value = '') => str.replace(new RegExp(`(\\[${ key }\\]|__${ key }__)`, 'igm'), value); +export const replacekey = (str, key, value = '') => str.replace(new RegExp(`(\\[${ key }\\]|__${ key }__)`, 'igm'), s.escapeHTML(value)); export const translate = (str) => str.replace(/\{ ?([^\} ]+)(( ([^\}]+))+)? ?\}/gmi, (match, key) => TAPi18n.__(key, { lng })); export const replace = function replace(str, data = {}) { if (!str) { diff --git a/server/methods/registerUser.js b/server/methods/registerUser.js index d95098efcae0..8b104dde7f35 100644 --- a/server/methods/registerUser.js +++ b/server/methods/registerUser.js @@ -3,18 +3,11 @@ import { Match, check } from 'meteor/check'; import { Accounts } from 'meteor/accounts-base'; import s from 'underscore.string'; -import * as Mailer from '../../app/mailer'; import { Users } from '../../app/models'; import { settings } from '../../app/settings'; import { saveCustomFields, validateEmailDomain, passwordPolicy } from '../../app/lib'; import { validateInviteToken } from '../../app/invites/server/functions/validateInviteToken'; -let verifyEmailTemplate = ''; -Meteor.startup(() => { - Mailer.getTemplateWrapped('Verification_Email', (value) => { - verifyEmailTemplate = value; - }); -}); Meteor.methods({ registerUser(formData) { const AllowAnonymousRead = settings.get('Accounts_AllowAnonymousRead'); @@ -86,11 +79,6 @@ Meteor.methods({ saveCustomFields(userId, formData); try { - const subject = Mailer.replace(settings.get('Verification_Email_Subject')); - - Accounts.emailTemplates.verifyEmail.subject = () => subject; - Accounts.emailTemplates.verifyEmail.html = (userModel, url) => Mailer.replace(Mailer.replacekey(verifyEmailTemplate, 'Verification_Url', url), userModel); - Accounts.sendVerificationEmail(userId, userData.email); } catch (error) { // throw new Meteor.Error 'error-email-send-failed', 'Error trying to send email: ' + error.message, { method: 'registerUser', message: error.message }