API
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

User.cs 1.2KB

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