The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
feat: Disable Continue Button for Invalid Email in Sign in/Sign up (#8022)
ZiaCodes7edfa615714d
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.tsxindex bed04b2e808..c75a3583432 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@@ -2,7 +2,10 @@ import { FooterNote } from '@/auth/sign-in-up/components/FooterNote';import { HorizontalSeparator } from '@/auth/sign-in-up/components/HorizontalSeparator';import { useHandleResetPassword } from '@/auth/sign-in-up/hooks/useHandleResetPassword';import { SignInUpMode, useSignInUp } from '@/auth/sign-in-up/hooks/useSignInUp';-import { useSignInUpForm } from '@/auth/sign-in-up/hooks/useSignInUpForm';+import {+ useSignInUpForm,+ validationSchema,+} from '@/auth/sign-in-up/hooks/useSignInUpForm';import { useSignInWithGoogle } from '@/auth/sign-in-up/hooks/useSignInWithGoogle';import { useSignInWithMicrosoft } from '@/auth/sign-in-up/hooks/useSignInWithMicrosoft';import { SignInUpStep } from '@/auth/states/signInUpStepState';@@ -127,7 +130,8 @@ export const SignInUpForm = () => {const isEmailStepSubmitButtonDisabledCondition =signInUpStep === SignInUpStep.Email &&- (form.watch('email')?.length === 0 || shouldWaitForCaptchaToken);+ (!validationSchema.shape.email.safeParse(form.watch('email')).success ||+ shouldWaitForCaptchaToken);// TODO: isValid is actually a proxy function. If it is not rendered the first time, react might not trigger re-renders// We make the isValid check synchronous and update a reactState to make sure this does not happendiff --git a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSignInUpForm.ts b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSignInUpForm.tsindex 817b276678b..07e2aaf7b17 100644--- a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSignInUpForm.ts+++ b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSignInUpForm.ts@@ -1,13 +1,13 @@+import { zodResolver } from '@hookform/resolvers/zod';import { useEffect } from 'react';import { useForm } from 'react-hook-form';-import { zodResolver } from '@hookform/resolvers/zod';import { useRecoilValue } from 'recoil';import { z } from 'zod';import { PASSWORD_REGEX } from '@/auth/utils/passwordRegex';import { isSignInPrefilledState } from '@/client-config/states/isSignInPrefilledState';-const validationSchema = z+export const validationSchema = z.object({exist: z.boolean(),email: z.string().trim().email('Email must be a valid email'),