API
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

User.cs 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using UnivateProperties_API.Helpers;
  2. namespace UnivateProperties_API.Model.Users
  3. {
  4. public class User : BaseEntity
  5. {
  6. #region Constructor
  7. public User(string username, string password)
  8. {
  9. Username = username;
  10. MyCommon.CreatePasswordHash(password, out byte[] passwordHash, out byte[] passwordSalt);
  11. PasswordHash = passwordHash;
  12. PasswordSalt = passwordSalt;
  13. }
  14. /// <summary>
  15. /// Do not use when creating new user
  16. /// </summary>
  17. public User()
  18. {
  19. }
  20. #endregion Constructor
  21. #region Properties
  22. public string Username { get; set; }
  23. public string Role { get; set; }
  24. public byte[] PasswordHash { get; set; }
  25. public byte[] PasswordSalt { get; set; }
  26. public bool Verified { get; set; }
  27. public string Token { get; set; }
  28. public bool AcceptedTerms { get; set; }
  29. #endregion Properties
  30. #region Methods
  31. public bool IsUserInRole(string role)
  32. {
  33. return Role == role;
  34. }
  35. #endregion
  36. }
  37. }