This project is read-only.

ASP.NET Identity, reset password throws 'Name is already taken'

Mar 25, 2015 at 8:09 PM
I have a password reset action in my mvc controller with this code:
var user = AuthService.GetUser(command.IdUser);
if (user == null)
    return PartialView("_MessageFailed", "The user doesn't exists");
if (user.TenantId != command.IdWebsite)
    return PartialView("_MessageFailed", "You are not allowed to reset this user password");
var token = AuthService.GenerateUserPasswordToken(user.Id);
var result = AuthService.ResetPassword(user.Id, token, command.NewPassword);
if (result.Succeeded)
    return PartialView("_MessageSuccess", "The password has changed");
return PartialView("_MessageFailed", string.Join("<br>", result.Errors));
The user exists, but I'm having an error in the result object in reset method that says
Name is already taken.
Why is this happening? Could be because in the aspnetusers table in the database are two users with the same email and different tenantId? How can I fix this?