SocialPub/SocialPub.ClientModels/LoginForm.cs

38 lines
1.9 KiB
C#
Raw Normal View History

2023-02-18 08:52:17 +01:00
using SocialPub.ClientModels.Resources;
using SocialPub.ClientModels.ValidatorAttributes;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace SocialPub.ClientModels
{
public class LoginForm
{
[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorsResource)),
Display(Name = "Username", ResourceType = typeof(FieldsNameResource)),
StringLength(32, MinimumLength = 3, ErrorMessageResourceName = "StringLengthMinMax", ErrorMessageResourceType = typeof(ErrorsResource)),
NoWhiteSpaces]
public string UserName { get; set; }
[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorsResource)),
DataType(DataType.Password, ErrorMessageResourceName = "InvalidPassword", ErrorMessageResourceType = typeof(ErrorsResource)),
PasswordPropertyText(true),
Display(Name = "Password", ResourceType = typeof(FieldsNameResource)),
StringLength(Constants.MaxPasswordLength, MinimumLength = Constants.MinPasswordLength, ErrorMessageResourceName = "StringLengthMinMax", ErrorMessageResourceType = typeof(ErrorsResource)),
RegularExpression(Constants.PasswordRegex, ErrorMessageResourceName = "InvalidPassword", ErrorMessageResourceType = typeof(ErrorsResource))]
public string Password { get; set; }
[Range(0, 359, ErrorMessageResourceName = nameof(Range), ErrorMessageResourceType = typeof(ErrorsResource))]
public short LightThemeIndexColour { get; set; } = 25;
[Range(0, 359, ErrorMessageResourceName = nameof(Range), ErrorMessageResourceType = typeof(ErrorsResource))]
public short DarkThemeIndexColour { get; set; } = 215;
public short IconsThemeIndexColour { get; set; } = 25;
public bool ThemeIsDarkGray { get; set; } = false;
public bool ThemeIsLightGray { get; set; } = false;
public bool PreferSystemTheming { get; set; } = false;
public bool ThemeIsDarkMode { get; set; } = false;
public string InvitationPassword { get; set; }
}
}