added user password hashing

This commit is contained in:
2025-04-22 23:04:21 +02:00
parent 9802a4a0e8
commit 8656254ff5

View File

@ -12,4 +12,20 @@ internal class User
public string Username { get; set; } public string Username { get; set; }
public string PasswordHash { get; set; } public string PasswordHash { get; set; }
public User(int id, string username, string passwordHash)
{
if (id <= 0)
throw new ArgumentOutOfRangeException("User Id must be positiv", nameof(id));
if (string.IsNullOrWhiteSpace(username))
throw new ArgumentException("Username can't be empty", nameof(username));
if (string.IsNullOrWhiteSpace(passwordHash))
throw new ArgumentException("Password hash can't be empty", nameof(passwordHash));
Id = id;
Username = username;
PasswordHash = passwordHash;
}
} }