feat(api): integrate infra and implement password verification on login

This commit is contained in:
Stevan Freeborn
2026-02-03 04:38:40 -06:00
parent 91662f5629
commit c2b681d267
4 changed files with 21 additions and 11 deletions
+12 -1
View File
@@ -1,3 +1,6 @@
using FiscalOS.Core.Identity;
namespace FiscalOS.API.Login;
internal static class Endpoint
@@ -11,7 +14,8 @@ internal static class Endpoint
private static async Task<IResult> HandleAsync(
[FromBody] LoginRequest loginRequest,
[FromServices] AppDbContext appDbContext
[FromServices] AppDbContext appDbContext,
[FromServices] IPasswordHasher passwordHasher
)
{
// TODO: Implement actual auth flow
@@ -37,6 +41,13 @@ internal static class Endpoint
return Results.Unauthorized();
}
var isCorrectPassword = passwordHasher.Verify(loginRequest.Password, user.HashedPassword);
if (isCorrectPassword is false)
{
return Results.Unauthorized();
}
return Results.Ok();
}
}