Password Reset Page
Hi folks, am I correct in that there is no
redirect
or success
action after resetting a password via email/password auth? I see a confirmation saying Your password has been reset.
but wasp should either redirect me to my dashboard/index after setting the new password or redirect to the login page. Leaving me with a form asking for my new password seems wrong
5 Replies
Hi @manoj. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
You are correct: by default, after a user resets their password using the email/password auth flow in Wasp, the user sees a confirmation message like "Your password has been reset." There is no automatic redirect to the dashboard, index, or login page after a successful password reset. The user remains on the reset password form page.
The official documentation and example code for the Reset Password Page show that after a successful reset, a message is displayed, but no redirect is performed automatically. If you want to redirect the user (for example, to the login page), you will need to customize the page component and add your own redirect logic after a successful password reset. The default
ResetPasswordForm
component does not handle this for you out of the box Docs: Reset Password Form.
This is consistent with the current Wasp behavior and documentation. If you want to improve the user experience, you can wrap the ResetPasswordForm
in your own component and use React hooks (like useState
and useEffect
) to perform a redirect after a successful reset.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @manoj, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?If i wanted to use a useEffect, what would we be detecting changes in? @kapa.ai
If i wanted to use a useEffect, what would we be detecting changes in? @kapa.ai
Let me check the knowledge base for you again. One moment! :books:
----------------------
The knowledge sources do not provide explicit details about the internal state or events exposed by the
ResetPasswordForm
component that you could directly observe with a useEffect
. The documentation only shows usage of the form and mentions that a confirmation message is displayed after a successful reset, but does not specify any props, callbacks, or state changes that you could hook into for a redirect Reset Password Form.
If you want to implement a redirect, you would likely need to create a custom password reset form instead of using the built-in ResetPasswordForm
, so you can control the success state yourself. In that case, you would detect changes in your own success state (e.g., a success
variable set after a successful password reset) and trigger a redirect in a useEffect
when it becomes true
.
But to reiterate, the knowledge sources do not provide a built-in way to detect success from the default ResetPasswordForm
for use with useEffect
.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @manoj, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?Following this. Wouldn't mind knowing the outcome.
should either redirect me to my dashboard/index after setting the new password or redirect to the login page.There should be some feedback on the action taken and the success message helps with that. But I agree, this is limiting that you can't redirect after the password reset. We don't offer any
onSuccess
callback where you can redirect the user. I've created an issue for this: https://github.com/wasp-lang/wasp/issues/2983
You can use the resetPassword
action from wasp/client/auth
and reimplement the form yourself and implement any custom behaviour 👍GitHub
Add a
onSuccess
callback for the reset password form · Issue #29...It would be useful if users could redirect to the login page after the password is successfully reset. For this we could introduce some sort of onSuccess callback. Based on: https://discord.com/cha...