Adds User Component
This commit is contained in:
parent
73a1f11e99
commit
69758735de
14 changed files with 222 additions and 65 deletions
23
PlanTempus.Components/Users/Create/CreateUserValidator.cs
Normal file
23
PlanTempus.Components/Users/Create/CreateUserValidator.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
using FluentValidation;
|
||||
|
||||
namespace PlanTempus.Components.Users.Create
|
||||
{
|
||||
public class CreateUserValidator : AbstractValidator<CreateUserCommand>
|
||||
{
|
||||
public CreateUserValidator()
|
||||
{
|
||||
RuleFor(x => x.Email)
|
||||
.NotEmpty().WithMessage("Email skal angives.")
|
||||
.EmailAddress().WithMessage("Ugyldig emailadresse.")
|
||||
.MaximumLength(256).WithMessage("Email må højst være 256 tegn.");
|
||||
|
||||
RuleFor(x => x.Password)
|
||||
.NotEmpty().WithMessage("Password skal angives.")
|
||||
.MinimumLength(8).WithMessage("Password skal være mindst 8 tegn.")
|
||||
.Matches("[A-Z]").WithMessage("Password skal indeholde mindst ét stort bogstav.")
|
||||
.Matches("[a-z]").WithMessage("Password skal indeholde mindst ét lille bogstav.")
|
||||
.Matches("[0-9]").WithMessage("Password skal indeholde mindst ét tal.")
|
||||
.Matches("[^a-zA-Z0-9]").WithMessage("Password skal indeholde mindst ét specialtegn.");
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue