Thank you for taking the time and reading this.
I've searched everywhere but didn't find the answer to this problem :(
public async Task<IEnumerable<IdentityError>> ChangePassword(ChangePasswordCommand model, string userId)
{
try
{
var user = await _userManager.FindByIdAsync(userId);
if (user == null)
return null;
var checkPasswordResult = await _userManager.CheckPasswordAsync(user, model.Password);
var result = await _userManager.ChangePasswordAsync(user, model.Password, model.NewPassword);
if (!result.Succeeded)
throw new ValidationException();
return new List<IdentityError>();
}
catch (Exception)
{
throw;
}
}
This thing returns DuplicateUserName.
When I add this line before ChangePasswordAsync():
_userManager.UserValidators.Clear()
It works.
How is the error connected to the password change operation?