added user password hashing
This commit is contained in:
@ -12,4 +12,20 @@ internal class User
|
||||
public string Username { 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user