mirror of
https://github.com/LD-Reborn/Berufsschule_HAM.git
synced 2025-12-20 06:51:55 +00:00
Added UserModel, Added Login and Logout and authorization, Made dark mode default
This commit is contained in:
6
src/Models/LoginViewModel.cs
Normal file
6
src/Models/LoginViewModel.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Berufsschule_HAM.Models;
|
||||
|
||||
class LoginViewModel
|
||||
{
|
||||
public string? ErrorText { get; set; }
|
||||
}
|
||||
36
src/Models/UserModels.cs
Normal file
36
src/Models/UserModels.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
namespace Berufsschule_HAM.Models;
|
||||
|
||||
public class UserModel
|
||||
{
|
||||
public required string Uid { get; set; }
|
||||
public string? Cn { get; set; }
|
||||
public string? Sn { get; set; }
|
||||
public string? Description { get; set; }
|
||||
public string? JpegPhoto { get; set; }
|
||||
public string? Title { get; set; }
|
||||
public string? UserPassword { get; set; }
|
||||
public UserModel(Dictionary<string, string> ldapData)
|
||||
{
|
||||
Uid = ldapData.GetValueOrDefault("uid") ?? throw new ArgumentException("UID is required");
|
||||
Cn = ldapData.GetValueOrDefault("cn");
|
||||
Sn = ldapData.GetValueOrDefault("sn");
|
||||
Description = ldapData.GetValueOrDefault("description");
|
||||
JpegPhoto = ldapData.GetValueOrDefault("jpegPhoto");
|
||||
Title = ldapData.GetValueOrDefault("title");
|
||||
UserPassword = ldapData.GetValueOrDefault("userPassword");
|
||||
}
|
||||
}
|
||||
|
||||
public class UserAuthenticationResult
|
||||
{
|
||||
public required bool Success;
|
||||
public UserNotAuthenticatedReason AuthenticationState { get; set; } = UserNotAuthenticatedReason.None;
|
||||
}
|
||||
|
||||
public enum UserNotAuthenticatedReason
|
||||
{
|
||||
None,
|
||||
InvalidCredentials,
|
||||
UserNotAuthorized,
|
||||
UserLockedOut
|
||||
}
|
||||
Reference in New Issue
Block a user