Added UserModel, Added Login and Logout and authorization, Made dark mode default

This commit is contained in:
2025-09-29 21:51:32 +02:00
parent 11c37376ad
commit 5c633bd17c
11 changed files with 246 additions and 20 deletions

View File

@@ -0,0 +1,6 @@
namespace Berufsschule_HAM.Models;
class LoginViewModel
{
public string? ErrorText { get; set; }
}

36
src/Models/UserModels.cs Normal file
View 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
}