Beispiel #1
0
        public PersonChangePasswordValidator(IPeopleRepository peopleRepository)
        {
            pwdValidator = new PasswordValidator(peopleRepository);

            RuleFor(x => x.Email)
            .NotEmpty().WithMessage("{PropertyName} musi mieć wartość").WithName("To pole");

            RuleFor(x => x.CurrentPassword)
            .NotEmpty().WithMessage("{PropertyName} musi mieć wartość").WithName("To pole");

            RuleFor(x => x.NewPassword)
            .SetValidator(pwdValidator);

            RuleFor(x => x.ConfirmPassword)
            .SetValidator(pwdValidator);

            RuleFor(x => x.ConfirmPassword.Value)
            .Equal(x => x.NewPassword.Value).WithMessage("Hasła muszą być identyczne");
        }