SocialPub/SocialPub.ClientModels/PasswordRecoveryForm.cs

25 lines
1.0 KiB
C#
Raw Normal View History

2023-02-18 08:52:17 +01:00
using SocialPub.ClientModels.Resources;
using System.ComponentModel.DataAnnotations;
namespace SocialPub.ClientModels
{
[AtLeastOneProperty(nameof(UserName), nameof(Email),
ErrorMessageResourceName = "AtLeastOneProperty",
ErrorMessageResourceType = typeof(ErrorsResource))]
public class PasswordRecoveryForm
{
[Display(Name = "UserName", ResourceType = typeof(FieldsNameResource)),
MinLength(3, ErrorMessageResourceName = "MinLength", ErrorMessageResourceType = typeof(ErrorsResource))]
public string UserName { get; set; }
[Display(Name = "Email", ResourceType = typeof(FieldsNameResource)),
DataType(DataType.EmailAddress),
MinLength(3, ErrorMessageResourceName = "MinLength", ErrorMessageResourceType = typeof(ErrorsResource)),
EmailAddress(ErrorMessageResourceName = "InvalidEmail", ErrorMessageResourceType = typeof(ErrorsResource))]
public string Email { get; set; }
public bool IsUsernameDisabled => !string.IsNullOrEmpty(Email);
public bool IsEmailDisabled => !string.IsNullOrEmpty(UserName);
}
}