diff --git a/backend/Directory.Packages.props b/backend/Directory.Packages.props
index e4c694a..259c422 100644
--- a/backend/Directory.Packages.props
+++ b/backend/Directory.Packages.props
@@ -25,7 +25,7 @@
-
+
diff --git a/backend/src/PnvPanel.Application/Auth/ChangePassword/ChangePasswordCommandValidator.cs b/backend/src/PnvPanel.Application/Auth/ChangePassword/ChangePasswordCommandValidator.cs
index d8f6acd..03d62be 100644
--- a/backend/src/PnvPanel.Application/Auth/ChangePassword/ChangePasswordCommandValidator.cs
+++ b/backend/src/PnvPanel.Application/Auth/ChangePassword/ChangePasswordCommandValidator.cs
@@ -7,6 +7,10 @@ public sealed class ChangePasswordCommandValidator : AbstractValidator x.CurrentPassword).NotEmpty();
- RuleFor(x => x.NewPassword).NotEmpty().MinimumLength(8);
+ RuleFor(x => x.NewPassword)
+ .NotEmpty()
+ .MinimumLength(8)
+ .Matches("^(?=.*[A-Z])(?=.*[0-9]).+$")
+ .WithMessage("Пароль должен содержать минимум одну заглавную букву и одну цифру.");
}
}
diff --git a/backend/src/PnvPanel.Application/Auth/Register/RegisterCommandValidator.cs b/backend/src/PnvPanel.Application/Auth/Register/RegisterCommandValidator.cs
index a763e27..af11994 100644
--- a/backend/src/PnvPanel.Application/Auth/Register/RegisterCommandValidator.cs
+++ b/backend/src/PnvPanel.Application/Auth/Register/RegisterCommandValidator.cs
@@ -14,6 +14,8 @@ public sealed class RegisterCommandValidator : AbstractValidator x.Password)
.NotEmpty()
- .MinimumLength(8);
+ .MinimumLength(8)
+ .Matches("^(?=.*[A-Z])(?=.*[0-9]).+$")
+ .WithMessage("Пароль должен содержать минимум одну заглавную букву и одну цифру.");
}
}
diff --git a/frontend/src/features/auth/RegisterForm.tsx b/frontend/src/features/auth/RegisterForm.tsx
index 1b2af04..16e8be9 100644
--- a/frontend/src/features/auth/RegisterForm.tsx
+++ b/frontend/src/features/auth/RegisterForm.tsx
@@ -15,7 +15,10 @@ const schema = z.object({
.min(3)
.max(32)
.regex(/^[a-zA-Z0-9_.-]+$/),
- password: z.string().min(8),
+ password: z
+ .string()
+ .min(8)
+ .regex(/^(?=.*[A-Z])(?=.*[0-9]).+$/),
})
type FormValues = z.infer
@@ -36,7 +39,11 @@ export function RegisterForm({ onSuccess }: { onSuccess: () => void }) {
onSuccess()
} catch (error) {
const message =
- error instanceof HttpError && error.status === 409 ? t('auth.duplicateUserName') : t('auth.genericError')
+ error instanceof HttpError && error.status === 409
+ ? t('auth.duplicateUserName')
+ : error instanceof HttpError
+ ? error.detail
+ : t('auth.genericError')
toast.error(message)
}
}
diff --git a/frontend/src/features/settings/ChangePasswordForm.tsx b/frontend/src/features/settings/ChangePasswordForm.tsx
index 2601a7d..e2794f4 100644
--- a/frontend/src/features/settings/ChangePasswordForm.tsx
+++ b/frontend/src/features/settings/ChangePasswordForm.tsx
@@ -12,7 +12,10 @@ import { changePassword } from '@/features/auth/api'
const schema = z.object({
currentPassword: z.string().min(1),
- newPassword: z.string().min(8),
+ newPassword: z
+ .string()
+ .min(8)
+ .regex(/^(?=.*[A-Z])(?=.*[0-9]).+$/),
})
type FormValues = z.infer