Commit efb8755b by asranov0003

feat: validate auth password inputs min lenght

parent 7dd94ee5
...@@ -203,7 +203,8 @@ ...@@ -203,7 +203,8 @@
}, },
"error": { "error": {
"requiredField": "This field is required", "requiredField": "This field is required",
"requiredCheckbox": "You must accept this" "requiredCheckbox": "You must accept this",
"passwordMinLength": "Password must be at least 6 characters"
}, },
"weekdays": { "weekdays": {
"monday": "Monday", "monday": "Monday",
......
...@@ -203,7 +203,8 @@ ...@@ -203,7 +203,8 @@
}, },
"error": { "error": {
"requiredField": "Это поле обязательное", "requiredField": "Это поле обязательное",
"requiredCheckbox": "Вы должны принять это" "requiredCheckbox": "Вы должны принять это",
"passwordMinLength": "Пароль должен содержать минимум 6 символов"
}, },
"weekdays": { "weekdays": {
"monday": "Понедельник", "monday": "Понедельник",
......
...@@ -203,7 +203,8 @@ ...@@ -203,7 +203,8 @@
}, },
"error": { "error": {
"requiredField": "Bu maydonni to'ldirish zarur", "requiredField": "Bu maydonni to'ldirish zarur",
"requiredCheckbox": "Siz bu ro'yxatni qabul qilishingiz kerak" "requiredCheckbox": "Siz bu ro'yxatni qabul qilishingiz kerak",
"passwordMinLength": "Parol kamida 6 ta belgidan iborat bo'lishi kerak"
}, },
"weekdays": { "weekdays": {
"monday": "Dushanba", "monday": "Dushanba",
......
...@@ -71,7 +71,13 @@ const Login: React.FC = () => { ...@@ -71,7 +71,13 @@ const Login: React.FC = () => {
label={`${t("auth.password")}`} label={`${t("auth.password")}`}
placeholder={`${t("auth.passwordPlaceholder")}`} placeholder={`${t("auth.passwordPlaceholder")}`}
type="password" type="password"
{...register("password", { required: t("error.requiredField") })} {...register("password", {
required: t("error.requiredField"),
minLength: {
value: 6,
message: t("error.passwordMinLength"),
},
})}
error={errors.password?.message as string} error={errors.password?.message as string}
/> />
......
...@@ -63,7 +63,13 @@ const Recover: React.FC = () => { ...@@ -63,7 +63,13 @@ const Recover: React.FC = () => {
label={`${t("auth.newPassword")}`} label={`${t("auth.newPassword")}`}
placeholder={`${t("auth.newPasswordPlaceholder")}`} placeholder={`${t("auth.newPasswordPlaceholder")}`}
type="password" type="password"
{...register("newPassword", { required: t("error.requiredField") })} {...register("newPassword", {
required: t("error.requiredField"),
minLength: {
value: 6,
message: t("error.passwordMinLength"),
},
})}
error={errors.newPassword?.message as string} error={errors.newPassword?.message as string}
/> />
......
...@@ -73,7 +73,13 @@ const Register: React.FC = () => { ...@@ -73,7 +73,13 @@ const Register: React.FC = () => {
label={`${t("auth.newPassword")}`} label={`${t("auth.newPassword")}`}
placeholder={`${t("auth.newPasswordPlaceholder")}`} placeholder={`${t("auth.newPasswordPlaceholder")}`}
type="password" type="password"
{...register("password", { required: t("error.requiredField") })} {...register("password", {
required: t("error.requiredField"),
minLength: {
value: 6,
message: t("error.passwordMinLength"),
},
})}
error={errors.password?.message as string} error={errors.password?.message as string}
/> />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment