using SocialPub.ClientModels.Resources; using System.ComponentModel; using System.ComponentModel.DataAnnotations; namespace SocialPub.ClientModels.User { public class UserForm { [EmailAddress(ErrorMessageResourceName = "InvalidEmail", ErrorMessageResourceType = typeof(ErrorsResource)), Display(Name = "Email", ResourceType = typeof(FieldsNameResource))] public string Email { get; set; } } public class UserPasswordForm { [Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorsResource)), DataType(DataType.Password, ErrorMessageResourceName = "InvalidPassword", ErrorMessageResourceType = typeof(ErrorsResource)), PasswordPropertyText(true), Display(Name = "OldPassword", ResourceType = typeof(FieldsNameResource)), StringLength(Constants.MaxPasswordLength, MinimumLength = Constants.MinPasswordLength, ErrorMessageResourceName = "StringLengthMinMax", ErrorMessageResourceType = typeof(ErrorsResource)), RegularExpression(Constants.PasswordRegex, ErrorMessageResourceName = "InvalidPassword", ErrorMessageResourceType = typeof(ErrorsResource))] public string OldPassword { get; set; } [Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorsResource)), DataType(DataType.Password, ErrorMessageResourceName = "InvalidPassword", ErrorMessageResourceType = typeof(ErrorsResource)), PasswordPropertyText(true), Display(Name = "NewPassword", ResourceType = typeof(FieldsNameResource)), StringLength(Constants.MaxPasswordLength, MinimumLength = Constants.MinPasswordLength, ErrorMessageResourceName = "StringLengthMinMax", ErrorMessageResourceType = typeof(ErrorsResource)), RegularExpression(Constants.PasswordRegex, ErrorMessageResourceName = "InvalidPassword", ErrorMessageResourceType = typeof(ErrorsResource))] public string NewPassword { get; set; } [Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorsResource)), DataType(DataType.Password, ErrorMessageResourceName = "InvalidPassword", ErrorMessageResourceType = typeof(ErrorsResource)), PasswordPropertyText(true), Compare(nameof(NewPassword), ErrorMessageResourceName = "ComparePasswords", ErrorMessageResourceType = typeof(ErrorsResource)), Display(Name = "NewPasswordConfirmation", ResourceType = typeof(FieldsNameResource))] public string RepeatedPassword { get; set; } } }