API
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. public bool LoginPasswordChange { get; set; }
  30. #endregion Properties
  31. #region Methods
  32. public bool IsUserInRole(string role)
  33. {
  34. return Role == role;
  35. }
  36. #endregion
  37. }
  38. }