Add no password login error message

This commit is contained in:
Zoe Roux 2024-05-27 12:00:08 +02:00
parent ef0260f3f5
commit 2ee71f8d8f
No known key found for this signature in database

View File

@ -211,6 +211,12 @@ public class AuthApi(
User? user = await users.GetOrDefault(
new Filter<User>.Eq(nameof(Abstractions.Models.User.Username), request.Username)
);
if (user != null && user.Password == null)
return Forbid(
new RequestError(
"This account was registerd via oidc. Please login via oidc or add a password to your account in the settings first"
)
);
if (user == null || !BCryptNet.Verify(request.Password, user.Password))
return Forbid(new RequestError("The user and password does not match."));