Update password validation rules and dependencies
- Updated the version of the ThreeXui.Net package from 1.0.0 to 1.0.1. - Enhanced password validation in ChangePasswordCommandValidator and RegisterCommandValidator to require at least one uppercase letter and one digit, with a custom error message in Russian. - Updated the password validation in RegisterForm and ChangePasswordForm to match the new requirements, ensuring consistency across the application.
This commit is contained in:
+5
-1
@@ -7,6 +7,10 @@ public sealed class ChangePasswordCommandValidator : AbstractValidator<ChangePas
|
||||
public ChangePasswordCommandValidator()
|
||||
{
|
||||
RuleFor(x => x.CurrentPassword).NotEmpty();
|
||||
RuleFor(x => x.NewPassword).NotEmpty().MinimumLength(8);
|
||||
RuleFor(x => x.NewPassword)
|
||||
.NotEmpty()
|
||||
.MinimumLength(8)
|
||||
.Matches("^(?=.*[A-Z])(?=.*[0-9]).+$")
|
||||
.WithMessage("Пароль должен содержать минимум одну заглавную букву и одну цифру.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@ public sealed class RegisterCommandValidator : AbstractValidator<RegisterCommand
|
||||
|
||||
RuleFor(x => x.Password)
|
||||
.NotEmpty()
|
||||
.MinimumLength(8);
|
||||
.MinimumLength(8)
|
||||
.Matches("^(?=.*[A-Z])(?=.*[0-9]).+$")
|
||||
.WithMessage("Пароль должен содержать минимум одну заглавную букву и одну цифру.");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user