Skip to content

feat: email-based forgot password for police accounts - #470

Merged
naasanov merged 1 commit into
mainfrom
feat/forgot-password-437
Jun 17, 2026
Merged

feat: email-based forgot password for police accounts#470
naasanov merged 1 commit into
mainfrom
feat/forgot-password-437

Conversation

@naasanov

Copy link
Copy Markdown
Collaborator

Police officers who forgot their password had no self-service recovery path — an admin had to delete and recreate their account. This adds a standard email-based forgot-password flow.

Changes:

  • Added password_reset_token and password_reset_token_expires_at fields to PoliceEntity with a check constraint (both null or both set), plus the corresponding Alembic migration
  • Added POST /api/auth/police/forgot-password and POST /api/auth/police/reset-password endpoints (public, no internal secret required); forgot-password always returns 204 to prevent user enumeration
  • Added request_password_reset, reset_password, and send_password_reset_email to PoliceService; password reset revokes all existing refresh tokens (invalidates sessions)
  • Added NEXT_PUBLIC_PASSWORD_RESET_TOKEN_EXPIRE_HOURS as a shared frontend/backend env var (default: 1); backend reads it via validation_alias, frontend exposes it through clientEnv
  • Added forgot-password and reset-password pages under police/(auth)/; login page now has a "Forgot password?" link; both new paths are added to PUBLIC_POLICE_PATHS in the proxy
  • Added robots.ts to disallow indexing of police auth pages (/police/signup, /police/verify, /police/forgot-password, /police/reset-password)
  • Added 10 new service-layer test cases covering request and reset flows (email sent/not sent, token overwrite, expiry, single-use, refresh token revocation, password update)
  • Updated alembic/script.py.mako to always include import src.core.types so future autogenerated migrations don't need it added manually

Closes #437

Police officers who forgot their password previously had no self-service
recovery path — an admin had to delete and recreate their account. This
adds a standard token-based forgot-password flow through email.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Test Results Summary

866 tests  +10   866 ✅ +10   1m 6s ⏱️ +5s
  1 suites ± 0     0 💤 ± 0 
  1 files   ± 0     0 ❌ ± 0 

Results for commit eb6b123. ± Comparison against base commit c69ee84.

@naasanov
naasanov merged commit 58742d9 into main Jun 17, 2026
3 checks passed
@naasanov
naasanov deleted the feat/forgot-password-437 branch June 17, 2026 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Forgot Password

1 participant