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:
Antoine Moreaux
2025-02-06 19:53:31 +01:00
committed by GitHub
parent c27e930293
commit 005762c240
3 changed files with 34 additions and 6 deletions

View File

@ -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}