From be97aa6f130a013342e39e9e0d289f783f30bac6 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Fri, 18 Jun 2021 13:04:02 -0400 Subject: [PATCH] feat(emails): +includeUnverifiedEmails ACP setting --- install/data/defaults.json | 1 + .../language/en-GB/admin/settings/email.json | 5 +- src/emailer.js | 2 +- src/views/admin/settings/email.tpl | 74 ++++++++++--------- 4 files changed, 43 insertions(+), 39 deletions(-) diff --git a/install/data/defaults.json b/install/data/defaults.json index f6c31125b2..fb0bf761ed 100644 --- a/install/data/defaults.json +++ b/install/data/defaults.json @@ -133,6 +133,7 @@ "disableEmailSubscriptions": 0, "emailConfirmInterval": 10, "removeEmailNotificationImages": 0, + "includeUnverifiedEmails": 0, "inviteExpiration": 7, "dailyDigestFreq": "off", "digestHour": 17, diff --git a/public/language/en-GB/admin/settings/email.json b/public/language/en-GB/admin/settings/email.json index 839fd2b6f6..9bdbde26a6 100644 --- a/public/language/en-GB/admin/settings/email.json +++ b/public/language/en-GB/admin/settings/email.json @@ -36,6 +36,7 @@ "subscriptions.disable": "Disable email digests", "subscriptions.hour": "Digest Hour", "subscriptions.hour-help": "Please enter a number representing the hour to send scheduled email digests (e.g. 0 for midnight, 17 for 5:00pm). Keep in mind that this is the hour according to the server itself, and may not exactly match your system clock.
The approximate server time is:
The next daily digest is scheduled to be sent ", - "notifications.settings": "Email notification settings", - "notifications.remove-images": "Remove images from email notifications" + "notifications.remove-images": "Remove images from email notifications", + "include-unverified-emails": "Send emails to recipients who have not explicitly confirmed their emails", + "include-unverified-warning": "By default, users with emails associated with their account have already been verified, but there are situations where this is not the case (e.g. SSO logins, grandfathered users, etc). Enable this setting at your own risk – sending emails to unverified addresses may be a violation of regional anti-spam laws." } \ No newline at end of file diff --git a/src/emailer.js b/src/emailer.js index c8cfd7cbe8..51f2143879 100644 --- a/src/emailer.js +++ b/src/emailer.js @@ -228,7 +228,7 @@ Emailer.send = async (template, uid, params) => { } const allowedTpls = ['verify_email', 'welcome', 'registration_accepted']; - if (!userData['email:confirmed'] && !allowedTpls.includes(template)) { + if (!meta.config.includeUnverifiedEmails && !userData['email:confirmed'] && !allowedTpls.includes(template)) { if (process.env.NODE_ENV === 'development') { winston.warn(`uid : ${uid} (${userData.email}) has not confirmed email, not sending "${template}" email.`); } diff --git a/src/views/admin/settings/email.tpl b/src/views/admin/settings/email.tpl index 6b856526ef..1a8e98177e 100644 --- a/src/views/admin/settings/email.tpl +++ b/src/views/admin/settings/email.tpl @@ -11,6 +11,7 @@


+

@@ -18,6 +19,43 @@


+ +
+ +
+ +
+ +
+

[[admin/settings/email:include-unverified-warning]]

+ + + + +
+
[[admin/settings/email:subscriptions]]
+
+
+
+ +
+ +
+ + +

+ [[admin/settings/email:subscriptions.hour-help]] +

+
@@ -132,40 +170,4 @@ -
-
[[admin/settings/email:subscriptions]]
-
-
-
- -
- -
- - -

- [[admin/settings/email:subscriptions.hour-help]] -

-
-
-
-
- -
-
[[admin/settings/email:notifications.settings]]
-
-
-
- -
-
-
-
-