fix: Username is undefined in email verification link on email change (#8887)
This commit is contained in:
@@ -161,7 +161,8 @@ export class UserController extends AdaptableController {
|
||||
return;
|
||||
}
|
||||
const token = encodeURIComponent(user._email_verify_token);
|
||||
// We may need to fetch the user in case of update email
|
||||
// We may need to fetch the user in case of update email; only use the `fetchedUser`
|
||||
// from this point onwards; do not use the `user` as it may not contain all fields.
|
||||
const fetchedUser = await this.getUserIfNeeded(user);
|
||||
let shouldSendEmail = this.config.sendUserEmailVerification;
|
||||
if (typeof shouldSendEmail === 'function') {
|
||||
@@ -176,7 +177,7 @@ export class UserController extends AdaptableController {
|
||||
if (!shouldSendEmail) {
|
||||
return;
|
||||
}
|
||||
const username = encodeURIComponent(user.username);
|
||||
const username = encodeURIComponent(fetchedUser.username);
|
||||
|
||||
const link = buildEmailLink(this.config.verifyEmailURL, username, token, this.config);
|
||||
const options = {
|
||||
|
||||
Reference in New Issue
Block a user