From 284b2677bea5128044fe7f2c08b0438ebce2401c Mon Sep 17 00:00:00 2001 From: Karan Khatik <100562135+Karankhatik@users.noreply.github.com> Date: Sun, 13 Oct 2024 23:22:35 +0530 Subject: [PATCH] [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 Co-authored-by: Charles Bochet --- .../modules/auth/sign-in-up/components/SignInUpForm.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/components/SignInUpForm.tsx b/packages/twenty-front/src/modules/auth/sign-in-up/components/SignInUpForm.tsx index 2068e8f730..65021f7c68 100644 --- a/packages/twenty-front/src/modules/auth/sign-in-up/components/SignInUpForm.tsx +++ b/packages/twenty-front/src/modules/auth/sign-in-up/components/SignInUpForm.tsx @@ -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; }