From 17685e76d8d5b9e7c484a55f9d101ec54e2d1e41 Mon Sep 17 00:00:00 2001 From: Robert Paciorek Date: Fri, 27 Jun 2025 14:46:23 +0000 Subject: [PATCH] fix null exception in LoginParent --- src/Controllers/Common/AuthenticationController.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Controllers/Common/AuthenticationController.cs b/src/Controllers/Common/AuthenticationController.cs index 465680a..96e1065 100644 --- a/src/Controllers/Common/AuthenticationController.cs +++ b/src/Controllers/Common/AuthenticationController.cs @@ -48,8 +48,13 @@ public class AuthenticationController : Controller { } else { user = ctx.Users.FirstOrDefault(e => e.Username == data.UserName); } + + if (user is null) { + return Ok(new ParentLoginInfo { Status = MembershipUserStatus.InvalidUserName }); + } + PasswordVerificationResult result = new PasswordHasher().VerifyHashedPassword(null, user.Password, data.Password); - if (user is null || result == PasswordVerificationResult.Failed) { + if (result == PasswordVerificationResult.Failed) { return Ok(new ParentLoginInfo { Status = MembershipUserStatus.InvalidPassword }); }