summaryrefslogtreecommitdiffstats
path: root/api/WhatApi/Endpoints/LoginEndpoint.cs
diff options
context:
space:
mode:
Diffstat (limited to 'api/WhatApi/Endpoints/LoginEndpoint.cs')
-rw-r--r--api/WhatApi/Endpoints/LoginEndpoint.cs4
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);