Merge pull request #2239 from sonvir249/bug/fix-form-errors
Issue-2238: Fixes the error messages on various forms.
This commit is contained in:
3 files changed
+14
-3
No files matched your search
@@ -185,7 +185,7 @@ const ForgotPassword = () => {
|
|||||||
value={form.email}
|
value={form.email}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
error={errors.email ? true : false}
|
error={errors.email ? true : false}
|
||||||
helperText={errors.email}
|
helperText={t(errors.email)}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
variant="contained"
|
variant="contained"
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ function StepTwo({ form, errors, onSubmit, onChange, onBack }) {
|
|||||||
helperText={errors.email && (
|
helperText={errors.email && (
|
||||||
errors.email.includes("required") ? t("authRegisterEmailRequired") :
|
errors.email.includes("required") ? t("authRegisterEmailRequired") :
|
||||||
errors.email.includes("valid email") ? t("authRegisterEmailInvalid") :
|
errors.email.includes("valid email") ? t("authRegisterEmailInvalid") :
|
||||||
errors.email
|
t(errors.email)
|
||||||
)}
|
)}
|
||||||
ref={inputRef}
|
ref={inputRef}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -15,6 +15,17 @@ const nameSchema = joi
|
|||||||
"Name must contain only letters, spaces, apostrophes, or hyphens",
|
"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
|
const passwordSchema = joi
|
||||||
.string()
|
.string()
|
||||||
.trim()
|
.trim()
|
||||||
@@ -54,7 +65,7 @@ const passwordSchema = joi
|
|||||||
|
|
||||||
const credentials = joi.object({
|
const credentials = joi.object({
|
||||||
firstName: nameSchema,
|
firstName: nameSchema,
|
||||||
lastName: nameSchema,
|
lastName: lastnameSchema,
|
||||||
email: joi
|
email: joi
|
||||||
.string()
|
.string()
|
||||||
.trim()
|
.trim()
|
||||||
|
|||||||
Reference in new issue
Block a user