feat(auth): password-reset via email-token + SPA forgot/reset flow#120
Merged
Conversation
Implements POST /api/auth/password-reset/{request,confirm} per
specs/api/auth.md and specs/behaviors/account-migration.md.
PasswordToken is a new private-store record keyed by SHA-256 of the
plaintext; the plaintext only leaves the system via the email send.
Request always returns 202 regardless of whether the address resolved
(anti-enumeration), and silently no-ops when the target has no legacy
credential — spec invariant that password-reset never *creates* a
credential. Confirm collapses every rejection path to a uniform 401
invalid_token, rotates the credential to argon2id at current params,
marks the token used, and mints a session with loginMethod
'password_reset'.
SPA adds a "Forgot your password?" link on the legacy-password form,
a /login/forgot request page (mirrors the always-confirm UX), and a
/login/reset?token=… confirm page that validates client-side and
handles 401/422/429 inline.
EmailNotifier gets a Resend-backed notifyPasswordReset; LoggingNotifier
deliberately redacts the token from logs even in dev — plaintext tokens
only appear over the email channel.
13 API tests + 5 web tests; full sweep (api 382, web 63, shared 75)
green; lint + type-check clean.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds plan file for the password-reset phase of the login-migration track. Status flips to done in a closeout commit once the PR is opened. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
All validation items ticked, PR opened. Status: in-progress → done. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Phase C of the login-migration impl track (phase A #118, phase B #119). Implements password-reset via email-token, per specs/api/auth.md + specs/behaviors/account-migration.md.
API
PasswordTokenprivate record — keyed by SHA-256 of the plaintext; plaintext leaves the system only via the email send.POST /api/auth/password-reset/request— always 202 (anti-enumeration); silently no-ops when target has no email or no legacy credential. Fire-and-forget notifier send.POST /api/auth/password-reset/confirm— single-use token, uniform 401invalid_tokenon every rejection path, rehashes to argon2id, rotates credential, mints session withloginMethod: 'password_reset'.EmailNotifier.notifyPasswordReset(Resend) +LoggingNotifierimpl that deliberately redacts the token from logs even in dev. Email template (text + HTML) lives innotify/templates.ts.SPA
/login/forgotrequest page — mirrors the always-confirm UX./login/reset?token=...confirm page — validates client-side + handles 401/422/429 inline.Tests — 13 new API tests + 5 new web tests. Full sweep: api 382/382, web 63/63, shared 75/75. Lint + type-check clean.
Plan: plans/login-migration-impl-phase-c.md — flips to
donein a closeout commit.Test plan
npm run -w apps/api test -- tests/auth-password-reset.test.ts— 13/13npm run -w apps/web test -- tests/PasswordReset.test.tsx— 5/5npm run type-check && npm run lintclean🤖 Generated with Claude Code