mirror of
https://github.com/SoDOff-Project/sodoff.git
synced 2025-10-11 08:18:49 -07:00
password rehashing
asp net identity v3 uses a new hashing algorithm (hmac-sha256)
This commit is contained in:
parent
0d6c8d6d47
commit
f33d93e276
@ -48,11 +48,15 @@ public class AuthenticationController : Controller {
|
||||
} else {
|
||||
user = ctx.Users.FirstOrDefault(e => e.Username == data.UserName);
|
||||
}
|
||||
|
||||
if (user is null || new PasswordHasher<object>().VerifyHashedPassword(null, user.Password, data.Password) != PasswordVerificationResult.Success) {
|
||||
PasswordVerificationResult result = new PasswordHasher<object>().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<object>().HashPassword(null, data.Password);
|
||||
}
|
||||
|
||||
// Create session
|
||||
Session session = new Session {
|
||||
User = user,
|
||||
|
Loading…
x
Reference in New Issue
Block a user