mirror of
https://github.com/LD-Reborn/Berufsschule_HAM.git
synced 2025-12-20 06:51:55 +00:00
Fixed uncaught exception when user not found
This commit is contained in:
@@ -142,6 +142,8 @@ public partial class LdapService : IDisposable
|
|||||||
public async Task<UserAuthenticationResult> AuthenticateUser(string username, string password)
|
public async Task<UserAuthenticationResult> AuthenticateUser(string username, string password)
|
||||||
{
|
{
|
||||||
await ConnectAndBind();
|
await ConnectAndBind();
|
||||||
|
try
|
||||||
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
UserModel user = await GetUserByUidAsync(username);
|
UserModel user = await GetUserByUidAsync(username);
|
||||||
@@ -155,6 +157,11 @@ public partial class LdapService : IDisposable
|
|||||||
}
|
}
|
||||||
return new() { Success = false, AuthenticationState = UserNotAuthenticatedReason.InvalidCredentials };
|
return new() { Success = false, AuthenticationState = UserNotAuthenticatedReason.InvalidCredentials };
|
||||||
}
|
}
|
||||||
|
catch (InvalidOperationException)
|
||||||
|
{
|
||||||
|
return new() { Success = false, AuthenticationState = UserNotAuthenticatedReason.InvalidCredentials };
|
||||||
|
}
|
||||||
|
}
|
||||||
catch (LdapException)
|
catch (LdapException)
|
||||||
{
|
{
|
||||||
return new() { Success = false, AuthenticationState = UserNotAuthenticatedReason.InvalidCredentials };
|
return new() { Success = false, AuthenticationState = UserNotAuthenticatedReason.InvalidCredentials };
|
||||||
|
|||||||
Reference in New Issue
Block a user