SocialPub/PrivaPub.ClientModels/PasswordRecoveryForm.cs

25 lines
1.0 KiB
C#
Raw Permalink Normal View History

2023-02-19 00:43:43 +01:00
using PrivaPub.ClientModels.Resources;
2023-02-18 08:52:17 +01:00
using System.ComponentModel.DataAnnotations;
2023-02-19 00:43:43 +01:00
namespace PrivaPub.ClientModels
2023-02-18 08:52:17 +01:00
{
[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);
}
}