fix: Conditional email verification not working in some cases if verifyUserEmails, preventLoginWithUnverifiedEmail set to functions (#8838)
This commit is contained in:
@@ -36,11 +36,10 @@ export class UserController extends AdaptableController {
|
||||
}
|
||||
|
||||
async setEmailVerifyToken(user, req, storage = {}) {
|
||||
let shouldSendEmail = this.shouldVerifyEmails;
|
||||
if (typeof shouldSendEmail === 'function') {
|
||||
const response = await Promise.resolve(shouldSendEmail(req));
|
||||
shouldSendEmail = response !== false;
|
||||
}
|
||||
const shouldSendEmail =
|
||||
this.shouldVerifyEmails === true ||
|
||||
(typeof this.shouldVerifyEmails === 'function' &&
|
||||
(await Promise.resolve(this.shouldVerifyEmails(req))) === true);
|
||||
if (!shouldSendEmail) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user