18 lines
550 B
C#
18 lines
550 B
C#
using FluentValidation;
|
|
using LittleShop.DTOs;
|
|
|
|
namespace LittleShop.Validators;
|
|
|
|
public class LoginDtoValidator : AbstractValidator<LoginDto>
|
|
{
|
|
public LoginDtoValidator()
|
|
{
|
|
RuleFor(x => x.Username)
|
|
.NotEmpty().WithMessage("Username is required")
|
|
.MaximumLength(50).WithMessage("Username cannot exceed 50 characters");
|
|
|
|
RuleFor(x => x.Password)
|
|
.NotEmpty().WithMessage("Password is required")
|
|
.MinimumLength(3).WithMessage("Password must be at least 3 characters long");
|
|
}
|
|
} |