Repository navigation
feat(auth): reset a forgotten password by email - #156
Merged
Merged
Conversation
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.
Closes #147
Backend
POST /api/auth/forgot-passwordalways answers 202, whether or not the email has an account. The email is sent on its own background thread, so the response time doesn't reveal it either.POST /api/auth/reset-passwordsets the new password (same rules as sign-up). Returns 204, or 400 for an invalid, used, or expired link.password_reset_tokensstores only a SHA-256 hash of each 32-byte random token. Tokens expire in 30 minutes, work once, and a newer link replaces older ones.users.password_changed_atis added too.pwv). The decoder rejects any token whose version no longer matches the user's, so a reset ends every existing session. This replaces aniatcomparison, which missed sessions created in the same second as the reset; the integration test caught it.LoggingEmailSenderprints the link instead.Frontend
/forgot-password, and/reset-password. The reset page removes the token from the address bar, and a successful reset returns to login with a confirmation.Before this works in production: create a Brevo account, verify a sender address, and set
MAIL_FROM,MAIL_USERNAME, andMAIL_PASSWORDin Render (APP_URLis set in render.yaml).Checked: backend
mvnw verify(new integration and rate-limit tests), frontend 68/68 tests and build, and the full flow by hand against a local API.