fix(auth): reset signInUp state when email change (#9990)
When you use a prefilled email the web app checks the db to know if the user exists. If not the web app enter in signUp mode. If you changed your email after, the signup mode was not reset. This PR fixes that. Fix the error with the message "Invalid sign in up params".
This commit is contained in:
@ -105,6 +105,12 @@ export const SignInUpGlobalScopeForm = () => {
|
||||
});
|
||||
};
|
||||
|
||||
const onEmailChange = (email: string) => {
|
||||
if (email !== form.getValues('email')) {
|
||||
setSignInUpStep(SignInUpStep.Email);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<StyledContentContainer>
|
||||
@ -116,7 +122,10 @@ export const SignInUpGlobalScopeForm = () => {
|
||||
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
|
||||
<FormProvider {...form}>
|
||||
<StyledForm onSubmit={form.handleSubmit(handleSubmit)}>
|
||||
<SignInUpEmailField showErrors={showErrors} />
|
||||
<SignInUpEmailField
|
||||
showErrors={showErrors}
|
||||
onInputChange={onEmailChange}
|
||||
/>
|
||||
{signInUpStep === SignInUpStep.Password && (
|
||||
<SignInUpPasswordField
|
||||
showErrors={showErrors}
|
||||
|
||||
Reference in New Issue
Block a user