Issue-2238: Fixes the error messages on various forms.

This commit is contained in:
sonvir249 committed 2025-05-11 06:21:12 +05:30
1 parent 6188d0c6a0
commit f0d2c57035
3 files changed
+14 -3

No files matched your search

+1 -1
View File
@@ -185,7 +185,7 @@ const ForgotPassword = () => {
value={form.email}
onChange={handleChange}
error={errors.email ? true : false}
helperText={errors.email}
helperText={t(errors.email)}
/>
<Button
variant="contained"
@@ -71,7 +71,7 @@ function StepTwo({ form, errors, onSubmit, onChange, onBack }) {
helperText={errors.email && (
errors.email.includes("required") ? t("authRegisterEmailRequired") :
errors.email.includes("valid email") ? t("authRegisterEmailInvalid") :
errors.email
t(errors.email)
)}
ref={inputRef}
/>
+12 -1
View File
@@ -14,6 +14,17 @@ const nameSchema = joi
"string.pattern.base": "Name must contain only letters, spaces, apostrophes, or hyphens"
});
const lastnameSchema = joi
.string()
.max(50)
.trim()
.pattern(/^[\p{L}\p{M}''\- ]+$/u)
.messages({
"string.empty": "Surname is required",
"string.max": "Surname must be less than 50 characters",
"string.pattern.base": "Surname must contain only letters, spaces, apostrophes, or hyphens"
});
const passwordSchema = joi
.string()
.trim()
@@ -53,7 +64,7 @@ const passwordSchema = joi
const credentials = joi.object({
firstName: nameSchema,
lastName: nameSchema,
lastName: lastnameSchema,
email: joi
.string()
.trim()