using FluentValidation; using Mizuki.Dtos; namespace Mizuki.Validators; /// /// The validator for the login data. /// public class LoginDataValidator : AbstractValidator { /// /// Constructs the ruleset for the LoginDataValidator. /// public LoginDataValidator() { RuleFor(x => x.Username) .NotEmpty(); RuleFor(x => x.Username) .Matches("^[a-zA-Z0-9_.]*$"); RuleFor(x => x.Password) .NotEmpty(); RuleFor(x => x.Password) .MinimumLength(8); RuleFor(x => x.Password) .Matches(@"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@#$%^&*!])[A-Za-z\d@#$%^&*!]{8,}$"); } }