-
-
Notifications
You must be signed in to change notification settings - Fork 340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allowing admin users to change users email #3118
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just did a preliminary review. I don't see any of the email code to trigger a link so the user can confirm the email change.
// Validate email change | ||
var emailValidationErrors = await _accountService.ValidateEmail(dto.Email); | ||
if (emailValidationErrors.Any()) return BadRequest(await _localizationService.Translate(User.GetUserId(), "email-taken")); | ||
user.Email = dto.Email; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need a new line after the if statement to help the code be easier to digest.
API/Controllers/AccountController.cs
Outdated
user.Email = dto.Email; | ||
user.EmailConfirmed = false; | ||
user.NormalizedEmail = _userManager.NormalizeEmail(dto.Email); | ||
user.ConfirmationToken = await _userManager.GenerateEmailConfirmationTokenAsync(user); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You generate a confirmation token, but I don't see you triggering an email for the end user to confirm and get rid of that pending status.
Not sure if you still want to work on this to get it in? |
Added new line as requested Removed the confirmation token since if the admin is changing the users email, it should be a force change. Set the `EmailConfirmed` status to `True`, again since the admin is the one pushing it through.
Changes made. Got rid of the email confirmation step because it is an admin making the change. That should force change it and not rely on the confirmation flow. Not sure what I was thinking before. |
Changed