feat: add ACP option to require email address on new registration

isekai-main
Julian Lam 3 years ago
parent 34afb74762
commit 006fc700dd

@ -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. <code>0</code> for midnight, <code>17</code> for 5:00pm). Keep in mind that this is the hour according to the server itself, and may not exactly match your system clock.<br /> The approximate server time is: <span id=\"serverTime\"></span><br /> The next daily digest is scheduled to be sent <span id=\"nextDigestTime\"></span>",
"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. <strong>It does not ensure user will enter a real email address, nor even an address they own.</strong>",
"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). <strong>Enable this setting at your own risk</strong> &ndash; sending emails to unverified addresses may be a violation of regional anti-spam laws."
}

@ -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()

@ -27,6 +27,14 @@
</label>
</div>
<div class="checkbox">
<label for="requireEmailAddress" class="mdl-switch mdl-js-switch mdl-js-ripple-effect">
<input class="mdl-switch__input" type="checkbox" id="requireEmailAddress" data-field="requireEmailAddress" name="requireEmailAddress" />
<span class="mdl-switch__label">[[admin/settings/email:require-email-address]]</span>
</label>
</div>
<p class="help-block">[[admin/settings/email:require-email-address-warning]]</p>
<div class="checkbox">
<label for="includeUnverifiedEmails" class="mdl-switch mdl-js-switch mdl-js-ripple-effect">
<input class="mdl-switch__input" type="checkbox" id="includeUnverifiedEmails" data-field="includeUnverifiedEmails" name="includeUnverifiedEmails" />

Loading…
Cancel
Save