Forgot password on SignInAndUp
# support-questions-legacy
d
Forgot password on SignInAndUp
Can we have ForgotPassword inside SignInAndUp component ? Same than signin and signup switch inside same component ? I dont want to be redirect to
Copy code
/auth/reset-password?rid=thirdpartyemailpassword
r
Hmmm this could be possible. I’ll have to get back to you about this sometime tomorrow though.
d
Ok thanks for your time !
r
So here is what you can do:
Copy code
jsx

render() {
  return (
    <ThirdPartyEmailPassword.SignInAndUp>
      <MyCustomTheme />
    </ThirdPartyEmailPassword.SignInAndUp>
  )
}

function MyCustomTheme(props) {
    let [showResetPassword, setShowResetPassword] = useState(false)
    if (showResetPassword) {
        return <ThirdPartyEmailPassword.ResetPasswordUsingToken />
    } else {
        let newProps = {
            ...props,
            epChildProps: {
                ...props.epChildProps,
                signInForm: {
                    ...props.epChildProps.signInForm,
                    forgotPasswordClick: () => {
                        setShowResetPassword(true)
                    }
                }
            }
        }
        return <ThirdPartyEmailPassword.SignInAndUpTheme {...newProps} />
    }
}
And this will render the reset password form on the same route as the sign in up form. Is this what you were looking for @djodjo02130
d
I will try it today ! Thanks again
Hi @rp_st, how arrow can show signin component instead of using redirect to
/auth?rid=thirdpartyemailpassword&show=signin
i want to call setShowResetPassword(false)
thanks again
r
Copy code
ts
render() {
  return (
    <ThirdPartyEmailPassword.SignInAndUp>
      <MyCustomTheme />
    </ThirdPartyEmailPassword.SignInAndUp>
  )
}

function MyCustomTheme(props) {
    let [showResetPassword, setShowResetPassword] = useState(false)
    if (showResetPassword) {
        return (
            <ThirdPartyEmailPassword.ResetPasswordUsingToken>
                <MyCustomResetPasswordTheme onBackPressed={() => {
                    setShowResetPassword(false)
                }} />
            </ThirdPartyEmailPassword.ResetPasswordUsingToken>)
    } else {
        let newProps = {
            ...props,
            epChildProps: {
                ...props.epChildProps,
                signInForm: {
                    ...props.epChildProps.signInForm,
                    forgotPasswordClick: () => {
                        setShowResetPassword(true)
                    }
                }
            }
        }
        return <ThirdPartyEmailPassword.SignInAndUpTheme {...newProps} />
    }
}

function MyCustomResetPasswordTheme(props) {
    let newProps = {
        ...props,
        enterEmailForm: {
            ...props.enterEmailForm,
            onBackButtonClicked: () => {
                props.onBackPressed()
            }
        }
    }
    return <ThirdPartyEmailPassword.ResetPasswordUsingTokenTheme {...newProps} />
}