UserLoginAttempt.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. using System;
  2. using System.ComponentModel.DataAnnotations;
  3. using System.ComponentModel.DataAnnotations.Schema;
  4. using Abp.Domain.Entities;
  5. using Abp.Domain.Entities.Auditing;
  6. using Abp.Timing;
  7. using IwbZero.MultiTenancy;
  8. namespace IwbZero.Authorization.Base.Users
  9. {
  10. /// <summary>
  11. /// 用于保存用户的登录尝试。
  12. /// </summary>
  13. [Table("Sys_UserLoginAttempts")]
  14. public class UserLoginAttempt : Entity<long>, IHasCreationTime, IMayHaveTenant
  15. {
  16. /// <summary>
  17. /// Max length of the <see cref="TenancyName"/> property.
  18. /// </summary>
  19. public const int MaxTenancyNameLength = TenantBase.MaxTenancyNameLength;
  20. /// <summary>
  21. /// Max length of the <see cref="TenancyName"/> property.
  22. /// </summary>
  23. public const int MaxUserNameOrEmailAddressLength = 255;
  24. /// <summary>
  25. /// Maximum length of <see cref="ClientIpAddress"/> property.
  26. /// </summary>
  27. public const int MaxClientIpAddressLength = 64;
  28. /// <summary>
  29. /// Maximum length of <see cref="ClientName"/> property.
  30. /// </summary>
  31. public const int MaxClientNameLength = 128;
  32. /// <summary>
  33. /// Maximum length of <see cref="BrowserInfo"/> property.
  34. /// </summary>
  35. public const int MaxBrowserInfoLength = 512;
  36. /// <summary>
  37. /// Tenant's Id, if <see cref="TenancyName"/> was a valid tenant name.
  38. /// </summary>
  39. public virtual int? TenantId { get; set; }
  40. /// <summary>
  41. /// Tenancy name.
  42. /// </summary>
  43. [StringLength(MaxTenancyNameLength)]
  44. public virtual string TenancyName { get; set; }
  45. /// <summary>
  46. /// User's Id, if <see cref="UserNameOrEmailAddress"/> was a valid username or email address.
  47. /// </summary>
  48. public virtual long? UserId { get; set; }
  49. /// <summary>
  50. /// User name or email address
  51. /// </summary>
  52. [StringLength(MaxUserNameOrEmailAddressLength)]
  53. public virtual string UserNameOrEmailAddress { get; set; }
  54. /// <summary>
  55. /// IP address of the client.
  56. /// </summary>
  57. [StringLength(MaxClientIpAddressLength)]
  58. public virtual string ClientIpAddress { get; set; }
  59. /// <summary>
  60. /// Name (generally computer name) of the client.
  61. /// </summary>
  62. [StringLength(MaxClientNameLength)]
  63. public virtual string ClientName { get; set; }
  64. /// <summary>
  65. /// Browser information if this method is called in a web request.
  66. /// </summary>
  67. [StringLength(MaxBrowserInfoLength)]
  68. public virtual string BrowserInfo { get; set; }
  69. /// <summary>
  70. /// Login attempt result.
  71. /// </summary>
  72. public virtual IwbLoginResultType Result { get; set; }
  73. public virtual DateTime CreationTime { get; set; }
  74. /// <summary>
  75. /// Initializes a new instance of the <see cref="UserLoginAttempt"/> class.
  76. /// </summary>
  77. public UserLoginAttempt()
  78. {
  79. CreationTime = Clock.Now;
  80. }
  81. }
  82. }