improve email validation error handling with partial string matching

This commit is contained in:
mohadeseh safari
2025-05-06 22:37:35 -04:00
parent f928322ec7
commit 4df4dc72e1
@@ -68,7 +68,11 @@ function StepTwo({ form, errors, onSubmit, onChange, onBack }) {
onInput={(e) => (e.target.value = e.target.value.toLowerCase())}
onChange={onChange}
error={errors.email ? true : false}
helperText={errors.email && (errors.email === "Email is required" ? t("authRegisterEmailRequired") : errors.email === "Must be a valid email address" ? t("authRegisterEmailInvalid") : errors.email)}
helperText={errors.email && (
errors.email.includes("required") ? t("authRegisterEmailRequired") :
errors.email.includes("valid email") ? t("authRegisterEmailInvalid") :
errors.email
)}
ref={inputRef}
/>
<Stack