fix(auth): allow password reset on self-hosted (remove IS_CLOUD gate on reset pages)#4665
Open
nizepart wants to merge 1 commit into
Open
fix(auth): allow password reset on self-hosted (remove IS_CLOUD gate on reset pages)#4665nizepart wants to merge 1 commit into
nizepart wants to merge 1 commit into
Conversation
Remove the IS_CLOUD guard in getServerSideProps of the reset-password and send-reset-password pages (and the now-unused IS_CLOUD import) so the password-reset flow works on self-hosted, not only on cloud. The reset email is already sent on-prem (emailAndPassword/sendResetPassword are not cloud-gated), but the page the link points to redirected to "/", making the flow a dead end. The token guard on /reset-password is kept and the token is validated server-side by better-auth.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Removes the
!IS_CLOUDredirect ingetServerSidePropsofreset-password.tsxandsend-reset-password.tsx(and the now-unusedIS_CLOUDimport), so the password-reset flow works on self-hosted, not only on cloud.Closes #4664
Why
The reset email is already sent on-prem (
sendResetPassword/emailAndPasswordare not cloud-gated), but the page the link points to redirected to/, making the whole flow a dead end for self-hosted users.Safety
/reset-passwordstill redirects to/when notokenquery param is present (guard kept). The new-password submit calls better-authresetPassword, which validates the token and its expiry server-side — no new server surface is exposed./send-reset-passwordis a public "enter email" form; submit calls the existingrequestPasswordReset(no account-existence disclosure).Notes
Admins who haven't configured SMTP simply won't receive emails (unchanged); those who have now get a working end-to-end reset.