12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- using UnivateProperties_API.Helpers;
-
- namespace UnivateProperties_API.Model.Users
- {
- public class User : BaseEntity
- {
- #region Constructor
- public User(string username, string password)
- {
- Username = username;
-
- MyCommon.CreatePasswordHash(password, out byte[] passwordHash, out byte[] passwordSalt);
-
- PasswordHash = passwordHash;
- PasswordSalt = passwordSalt;
- }
-
- /// <summary>
- /// Do not use when creating new user
- /// </summary>
- public User()
- {
-
- }
- #endregion Constructor
-
- #region Properties
- public string Username { get; set; }
- public string Role { get; set; }
- public byte[] PasswordHash { get; set; }
- public byte[] PasswordSalt { get; set; }
- public bool Verified { get; set; }
- public string Token { get; set; }
- #endregion Properties
-
- #region Methods
- public bool IsUserInRole(string role)
- {
- return Role == role;
- }
- #endregion
- }
- }
|