From 2ee71f8d8f526200ea70f676ee7ee546761c76be Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Mon, 27 May 2024 12:00:08 +0200 Subject: [PATCH] Add no password login error message --- back/src/Kyoo.Authentication/Views/AuthApi.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/back/src/Kyoo.Authentication/Views/AuthApi.cs b/back/src/Kyoo.Authentication/Views/AuthApi.cs index 6e3548f2..550e1990 100644 --- a/back/src/Kyoo.Authentication/Views/AuthApi.cs +++ b/back/src/Kyoo.Authentication/Views/AuthApi.cs @@ -211,6 +211,12 @@ public class AuthApi( User? user = await users.GetOrDefault( new Filter.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."));