diff --git a/public/language/en-GB/admin/settings/email.json b/public/language/en-GB/admin/settings/email.json
index 9bdbde26a6..af4e100eb6 100644
--- a/public/language/en-GB/admin/settings/email.json
+++ b/public/language/en-GB/admin/settings/email.json
@@ -37,6 +37,8 @@
"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.remove-images": "Remove images from email notifications",
+ "require-email-address": "Require new users to specify an email address",
+ "require-email-address-warning": "By default, users can opt-out of entering an email address. Enabling this option means they have to enter an email address in order to proceed with registration. It does not ensure user will enter a real email address, nor even an address they own.",
"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/user/interstitials.js b/src/user/interstitials.js
index 5467711503..3a98b12373 100644
--- a/src/user/interstitials.js
+++ b/src/user/interstitials.js
@@ -57,9 +57,15 @@ Interstitials.email = async (data) => {
// User attempting to edit another user's email -- not allowed
throw new Error('[[error:no-privileges]]');
}
- } else if (current) {
- // User explicitly clearing their email
- await user.email.remove(userData.uid, data.req.session.id);
+ } else {
+ if (meta.config.requireEmailAddress) {
+ throw new Error('[[error:invalid-email]]');
+ }
+
+ if (current) {
+ // User explicitly clearing their email
+ await user.email.remove(userData.uid, data.req.session.id);
+ }
}
} else {
// New registrants have the confirm email sent from user.create()
diff --git a/src/views/admin/settings/email.tpl b/src/views/admin/settings/email.tpl
index 76286d117e..9d33950d7a 100644
--- a/src/views/admin/settings/email.tpl
+++ b/src/views/admin/settings/email.tpl
@@ -27,6 +27,14 @@
+
[[admin/settings/email:require-email-address-warning]]
+