Skip to content

Commit

Permalink
Merge pull request #2203 from abpframework/maliming/identity-patch1
Browse files Browse the repository at this point in the history
Handling cases where Email and PhoneNumber have not changed.
  • Loading branch information
maliming authored Nov 19, 2019
2 parents e782dfa + f09a93c commit d0f6963
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 (!string.Equals(user.Email, input.Email, StringComparison.InvariantCultureIgnoreCase))
{
(await _userManager.SetEmailAsync(user, input.Email)).CheckErrors();
}

if (!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();

Expand Down

0 comments on commit d0f6963

Please sign in to comment.