mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
refactor: dont generate UUID if no email
This commit is contained in:
@@ -124,11 +124,6 @@ UserEmail.sendValidationEmail = async function (uid, options) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const confirm_code = utils.generateUUID();
|
|
||||||
const confirm_link = `${nconf.get('url')}/confirm/${confirm_code}`;
|
|
||||||
|
|
||||||
const { emailConfirmInterval, emailConfirmExpiry } = meta.config;
|
|
||||||
|
|
||||||
// If no email passed in (default), retrieve email from uid
|
// If no email passed in (default), retrieve email from uid
|
||||||
if (!options.email || !options.email.length) {
|
if (!options.email || !options.email.length) {
|
||||||
options.email = await user.getUserField(uid, 'email');
|
options.email = await user.getUserField(uid, 'email');
|
||||||
@@ -138,10 +133,13 @@ UserEmail.sendValidationEmail = async function (uid, options) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { emailConfirmInterval, emailConfirmExpiry } = meta.config;
|
||||||
if (!options.force && !await UserEmail.canSendValidation(uid, options.email)) {
|
if (!options.force && !await UserEmail.canSendValidation(uid, options.email)) {
|
||||||
throw new Error(`[[error:confirm-email-already-sent, ${emailConfirmInterval}]]`);
|
throw new Error(`[[error:confirm-email-already-sent, ${emailConfirmInterval}]]`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const confirm_code = utils.generateUUID();
|
||||||
|
const confirm_link = `${nconf.get('url')}/confirm/${confirm_code}`;
|
||||||
const username = await user.getUserField(uid, 'username');
|
const username = await user.getUserField(uid, 'username');
|
||||||
const data = await plugins.hooks.fire('filter:user.verify', {
|
const data = await plugins.hooks.fire('filter:user.verify', {
|
||||||
uid,
|
uid,
|
||||||
|
|||||||
Reference in New Issue
Block a user