From b6297c373ee647670b7426eceee2a567abd4d131 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Robles?= Date: Wed, 31 Aug 2022 13:27:25 -0500 Subject: [PATCH] Support HTML format when sending email auth-codes (#245) Support HTML format when sending email auth-codes (#244) * add html message * common service var * fix --- SequentConfig.js | 5 +++++ avRegistration/auth-method-service.js | 4 ++++ dist/SequentConfig-v6.1.5.js | 5 +++++ dist/appCommon-v6.1.5.js | 3 ++- 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/SequentConfig.js b/SequentConfig.js index ea123ea6..ef98c0f4 100644 --- a/SequentConfig.js +++ b/SequentConfig.js @@ -57,6 +57,11 @@ var SequentConfigData = { // Allowed values: true|false allowEditElectionJson: true, + // For admins: + // Allow sending custom html in the email messages sent from the admin console. + // Allowed values: true|false + allowHtmlEmails: false, + // For admins: // Allow editing the election.presentation.theme_css so that any election // Admin can highly customize the election directly with CSS. diff --git a/avRegistration/auth-method-service.js b/avRegistration/auth-method-service.js index 23b3a51d..c110505b 100644 --- a/avRegistration/auth-method-service.js +++ b/avRegistration/auth-method-service.js @@ -550,6 +550,10 @@ angular.module('avRegistration') data.msg = election.census.config.msg; if ('email' === auth_method) { data.subject = election.census.config.subject; + if (ConfigService.allowHtmlEmails && + election.census.config.html_message) { + data.html_message = election.census.config.html_message; + } } } if (angular.isDefined(user_ids)) { diff --git a/dist/SequentConfig-v6.1.5.js b/dist/SequentConfig-v6.1.5.js index ea123ea6..ef98c0f4 100644 --- a/dist/SequentConfig-v6.1.5.js +++ b/dist/SequentConfig-v6.1.5.js @@ -57,6 +57,11 @@ var SequentConfigData = { // Allowed values: true|false allowEditElectionJson: true, + // For admins: + // Allow sending custom html in the email messages sent from the admin console. + // Allowed values: true|false + allowHtmlEmails: false, + // For admins: // Allow editing the election.presentation.theme_css so that any election // Admin can highly customize the election directly with CSS. diff --git a/dist/appCommon-v6.1.5.js b/dist/appCommon-v6.1.5.js index 5fce2fd1..e877d2ed 100644 --- a/dist/appCommon-v6.1.5.js +++ b/dist/appCommon-v6.1.5.js @@ -277,7 +277,8 @@ angular.module("avRegistration").config(function() {}), angular.module("avRegist }, sendAuthCodes: function(data, election, user_ids, auth_method, extra) { var url = backendUrl + "auth-event/" + data + "/census/send_auth/", data = {}; - return angular.isDefined(election) && (data.msg = election.census.config.msg, "email" === auth_method && (data.subject = election.census.config.subject)), + return angular.isDefined(election) && (data.msg = election.census.config.msg, "email" === auth_method && (data.subject = election.census.config.subject, + ConfigService.allowHtmlEmails && election.census.config.html_message && (data.html_message = election.census.config.html_message))), angular.isDefined(user_ids) && (data["user-ids"] = user_ids), angular.isDefined(auth_method) && (data["auth-method"] = auth_method), extra && (data.extra = extra), $http.post(url, data); },