diff options
| author | ivar <i@oiee.no> | 2025-12-04 23:30:39 +0100 |
|---|---|---|
| committer | ivar <i@oiee.no> | 2025-12-04 23:30:39 +0100 |
| commit | 8c355b82df02bc650c5ba101d838121f485e8581 (patch) | |
| tree | 00ff527de5968d7899f7f653355073b8a416328b /api/WhatApi/Endpoints/LoginEndpoint.cs | |
| parent | deade767eace22a8c5281dcd5360c300395e2b5e (diff) | |
| download | what-8c355b82df02bc650c5ba101d838121f485e8581.tar.xz what-8c355b82df02bc650c5ba101d838121f485e8581.zip | |
Diffstat (limited to 'api/WhatApi/Endpoints/LoginEndpoint.cs')
| -rw-r--r-- | api/WhatApi/Endpoints/LoginEndpoint.cs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/api/WhatApi/Endpoints/LoginEndpoint.cs b/api/WhatApi/Endpoints/LoginEndpoint.cs index cb76696..470ef34 100644 --- a/api/WhatApi/Endpoints/LoginEndpoint.cs +++ b/api/WhatApi/Endpoints/LoginEndpoint.cs @@ -17,10 +17,10 @@ public class LoginEndpoint(AppDatabase db, IConfiguration configuration) : BaseE [HttpPost("~/login")] public async Task<ActionResult> HandleAsync([FromForm] LoginRequest login, CancellationToken ct = default) { var user = await db.Users.FirstOrDefaultAsync(c => c.Name == login.Username, ct); - if (user?.PasswordHash is null) return Unauthorized(); + if (user?.PasswordHash is null) return Redirect("/login?error=Ukjent bruker/passord"); var verificationResult = PasswordHasher.VerifyHashedPassword(user.PasswordHash, login.Password); - if (verificationResult == PasswordVerificationResult.Failed) return Unauthorized(); + if (verificationResult == PasswordVerificationResult.Failed) return Redirect("/login?error=Ukjent bruker/passord"); var tokenEntropy = configuration.GetValue<string>(Constants.Env.TokenEntropy); |
