AccountModels.cs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel.DataAnnotations;
  4. using System.ComponentModel.DataAnnotations.Schema;
  5. using System.Data.Entity;
  6. using System.Globalization;
  7. using System.Web.Mvc;
  8. using System.Web.Security;
  9. namespace EMIS.Web.Models
  10. {
  11. public class RegisterExternalLoginModel
  12. {
  13. [Required]
  14. [Display(Name = "用户名")]
  15. public string UserName { get; set; }
  16. public string ExternalLoginData { get; set; }
  17. }
  18. public class LocalPasswordModel
  19. {
  20. [Required]
  21. [DataType(DataType.Password)]
  22. [Display(Name = "当前密码")]
  23. public string OldPassword { get; set; }
  24. [Required]
  25. [StringLength(100, ErrorMessage = "{0} 必须至少包含 {2} 个字符。", MinimumLength = 6)]
  26. [DataType(DataType.Password)]
  27. [Display(Name = "新密码")]
  28. public string NewPassword { get; set; }
  29. [DataType(DataType.Password)]
  30. [Display(Name = "确认新密码")]
  31. [System.ComponentModel.DataAnnotations.Compare("NewPassword", ErrorMessage = "新密码和确认密码不匹配。")]
  32. public string ConfirmPassword { get; set; }
  33. }
  34. public class LoginModel
  35. {
  36. [Required]
  37. [Display(Name = "用户名")]
  38. public string UserName { get; set; }
  39. [Required]
  40. [DataType(DataType.Password)]
  41. [Display(Name = "密码")]
  42. public string Password { get; set; }
  43. [Display(Name = "记住我?")]
  44. public bool RememberMe { get; set; }
  45. }
  46. public class RegisterModel
  47. {
  48. [Required]
  49. [Display(Name = "用户名")]
  50. public string UserName { get; set; }
  51. [Required]
  52. [StringLength(100, ErrorMessage = "{0} 必须至少包含 {2} 个字符。", MinimumLength = 6)]
  53. [DataType(DataType.Password)]
  54. [Display(Name = "密码")]
  55. public string Password { get; set; }
  56. [DataType(DataType.Password)]
  57. [Display(Name = "确认密码")]
  58. [System.ComponentModel.DataAnnotations.Compare("Password", ErrorMessage = "密码和确认密码不匹配。")]
  59. public string ConfirmPassword { get; set; }
  60. }
  61. public class ExternalLogin
  62. {
  63. public string Provider { get; set; }
  64. public string ProviderDisplayName { get; set; }
  65. public string ProviderUserId { get; set; }
  66. }
  67. }