diff --git a/src/Controllers/Common/AuthenticationController.cs b/src/Controllers/Common/AuthenticationController.cs index 3fc5548..465680a 100644 --- a/src/Controllers/Common/AuthenticationController.cs +++ b/src/Controllers/Common/AuthenticationController.cs @@ -48,11 +48,15 @@ public class AuthenticationController : Controller { } else { user = ctx.Users.FirstOrDefault(e => e.Username == data.UserName); } - - if (user is null || new PasswordHasher().VerifyHashedPassword(null, user.Password, data.Password) != PasswordVerificationResult.Success) { + PasswordVerificationResult result = new PasswordHasher().VerifyHashedPassword(null, user.Password, data.Password); + if (user is null || result == PasswordVerificationResult.Failed) { return Ok(new ParentLoginInfo { Status = MembershipUserStatus.InvalidPassword }); } + if (result == PasswordVerificationResult.SuccessRehashNeeded) { + user.Password = new PasswordHasher().HashPassword(null, data.Password); + } + // Create session Session session = new Session { User = user,