mirror of
https://github.com/SoDOff-Project/sodoff.git
synced 2025-10-11 08:18:49 -07:00
fix null exception in LoginParent
This commit is contained in:
parent
bdd4111722
commit
17685e76d8
@ -48,8 +48,13 @@ public class AuthenticationController : Controller {
|
|||||||
} else {
|
} else {
|
||||||
user = ctx.Users.FirstOrDefault(e => e.Username == data.UserName);
|
user = ctx.Users.FirstOrDefault(e => e.Username == data.UserName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (user is null) {
|
||||||
|
return Ok(new ParentLoginInfo { Status = MembershipUserStatus.InvalidUserName });
|
||||||
|
}
|
||||||
|
|
||||||
PasswordVerificationResult result = new PasswordHasher<object>().VerifyHashedPassword(null, user.Password, data.Password);
|
PasswordVerificationResult result = new PasswordHasher<object>().VerifyHashedPassword(null, user.Password, data.Password);
|
||||||
if (user is null || result == PasswordVerificationResult.Failed) {
|
if (result == PasswordVerificationResult.Failed) {
|
||||||
return Ok(new ParentLoginInfo { Status = MembershipUserStatus.InvalidPassword });
|
return Ok(new ParentLoginInfo { Status = MembershipUserStatus.InvalidPassword });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user