-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handling cases where Email and PhoneNumber have not changed.
Resolve #2140
- Loading branch information
Showing
1 changed file
with
10 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,8 +127,16 @@ await _userManager.FindByEmailAsync(email) | |
|
||
private async Task UpdateUserByInput(IdentityUser user, IdentityUserCreateOrUpdateDtoBase input) | ||
{ | ||
(await _userManager.SetEmailAsync(user, input.Email)).CheckErrors(); | ||
(await _userManager.SetPhoneNumberAsync(user, input.PhoneNumber)).CheckErrors(); | ||
if (!input.Email.IsNullOrWhiteSpace() && !string.Equals(user.Email, input.Email, StringComparison.InvariantCultureIgnoreCase)) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
goxiaoy
Contributor
|
||
{ | ||
(await _userManager.SetEmailAsync(user, input.Email)).CheckErrors(); | ||
} | ||
|
||
if (!input.PhoneNumber.IsNullOrWhiteSpace() && !string.Equals(user.PhoneNumber, input.PhoneNumber, StringComparison.InvariantCultureIgnoreCase)) | ||
{ | ||
(await _userManager.SetPhoneNumberAsync(user, input.PhoneNumber)).CheckErrors(); | ||
} | ||
|
||
(await _userManager.SetTwoFactorEnabledAsync(user, input.TwoFactorEnabled)).CheckErrors(); | ||
(await _userManager.SetLockoutEnabledAsync(user, input.LockoutEnabled)).CheckErrors(); | ||
|
||
|
It will ignore null
Email
input when the admin want to set a user's email address to empty.