[Fix] - Issue with Email Validation and API Call Trigger on Login #7510 (#7596)

Purpose: Enhance email validation in the SignInUpForm component.

Changes:
- Implemented strict email format validation.
- Disabled the "Continue" button until email validation is complete.
- Displayed error messages for invalid email formats.


![image](https://github.com/user-attachments/assets/62f3c114-002e-4f9f-b18f-5309dfc43587)

---------

Co-authored-by: karankhatik <karan13699@gmail.com>
Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
Karan Khatik 2024-10-13 23:22:35 +05:30 committed by GitHub
parent 73cb8c5561
commit 284b2677be
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -76,6 +76,10 @@ export const SignInUpForm = () => {
if (signInUpStep === SignInUpStep.Init) {
continueWithEmail();
} else if (signInUpStep === SignInUpStep.Email) {
if (isDefined(form?.formState?.errors?.email)) {
setShowErrors(true);
return;
}
continueWithCredentials();
} else if (signInUpStep === SignInUpStep.Password) {
if (!form.formState.isSubmitting) {
@ -238,6 +242,10 @@ export const SignInUpForm = () => {
return;
}
if (signInUpStep === SignInUpStep.Email) {
if (isDefined(form?.formState?.errors?.email)) {
setShowErrors(true);
return;
}
continueWithCredentials();
return;
}