Skip to content

Add password reset flow (API, UI, DB migration, mailer, i18n, tests)#156

Merged
ultimate merged 3 commits into
mainfrom
codex/add-password-reset-request-feature
Jul 11, 2026
Merged

Add password reset flow (API, UI, DB migration, mailer, i18n, tests)#156
ultimate merged 3 commits into
mainfrom
codex/add-password-reset-request-feature

Conversation

@ultimate

Copy link
Copy Markdown
Owner

Motivation

  • Implement a complete password reset flow so users can request a reset link and set a new password securely.
  • Store and validate single-use, time-limited reset tokens hashed in the database to avoid leaking raw tokens.
  • Provide user-facing pages and localized copy for requesting and confirming password resets while avoiding information leaks about account existence.

Description

  • Added API endpoints POST /api/password-reset/request and POST /api/password-reset/confirm that call requestPasswordReset and resetPasswordWithToken respectively and return generic or error responses.
  • Implemented token generation, hashing, expiry handling, single-use semantics, and password update logic in requestPasswordReset and resetPasswordWithToken inside app/lib/users.ts and added helper hashPasswordResetToken and buildPasswordResetUrl.
  • Introduced a minimal sendPasswordResetEmail mailer stub in app/lib/mailer.ts which logs the reset URL in non-production environments.
  • Added DB migration 018_password_reset_tokens.sql and updated schema.sql to include the password_reset_tokens table and relevant indexes.
  • Added user-facing pages and components: app/forgot-password/page.tsx, app/reset-password/page.tsx, and linked the forgot-password page from AuthForm.tsx plus a small UI success style adjustment in CSS (.auth-success).
  • Extended i18n dictionaries (en, de, fr, it) with copy keys for the reset flow and added tests and type rows for password reset token DB interactions in users.ts.
  • Added unit tests for both endpoints in tests/app/api/password-reset-route.test.ts that mock requestPasswordReset and resetPasswordWithToken.

Testing

  • Ran the new endpoint unit tests in tests/app/api/password-reset-route.test.ts using vitest, and they passed locally.

Codex Task

@ultimate ultimate added the codex Things in relation to codex (caused by codex or good task for codex) label Jul 11, 2026 — with ChatGPT Codex Connector
@vercel

vercel Bot commented Jul 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ultilog Ready Ready Preview, Comment Jul 11, 2026 12:21pm

@ultimate ultimate merged commit 8ddd92e into main Jul 11, 2026
3 checks passed
@ultimate ultimate deleted the codex/add-password-reset-request-feature branch July 11, 2026 12:24
@ultimate

Copy link
Copy Markdown
Owner Author

Implements #121

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex Things in relation to codex (caused by codex or good task for codex)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant