fix: Passwort-Änderung bei falschem Passwort gibt 403 statt 401 zurück
401 triggerte den globalen Auth-Handler und redirectete zum Login-Screen. 403 (Forbidden) ist semantisch korrekt und zeigt die Fehlermeldung inline an.
This commit is contained in:
1 parent
7149904ae4
commit
c128341f95
1 file changed
+1
-1
@@ -83,7 +83,7 @@ public static class ProfileEndpoint
|
|||||||
var user = await db.GetUser(userId);
|
var user = await db.GetUser(userId);
|
||||||
if (user == null || !auth.VerifyPassword(currentPassword, user.PasswordHash))
|
if (user == null || !auth.VerifyPassword(currentPassword, user.PasswordHash))
|
||||||
{
|
{
|
||||||
ctx.Response.StatusCode = 401;
|
ctx.Response.StatusCode = 403;
|
||||||
await ctx.Response.WriteAsJsonAsync(new { error = "Aktuelles Passwort ist falsch" });
|
await ctx.Response.WriteAsJsonAsync(new { error = "Aktuelles Passwort ist falsch" });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user