feat: email-based forgot password for police accounts - #470
Merged
Conversation
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>
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.
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:
password_reset_tokenandpassword_reset_token_expires_atfields toPoliceEntitywith a check constraint (both null or both set), plus the corresponding Alembic migrationPOST /api/auth/police/forgot-passwordandPOST /api/auth/police/reset-passwordendpoints (public, no internal secret required); forgot-password always returns 204 to prevent user enumerationrequest_password_reset,reset_password, andsend_password_reset_emailtoPoliceService; password reset revokes all existing refresh tokens (invalidates sessions)NEXT_PUBLIC_PASSWORD_RESET_TOKEN_EXPIRE_HOURSas a shared frontend/backend env var (default: 1); backend reads it viavalidation_alias, frontend exposes it throughclientEnvpolice/(auth)/; login page now has a "Forgot password?" link; both new paths are added toPUBLIC_POLICE_PATHSin the proxyrobots.tsto disallow indexing of police auth pages (/police/signup,/police/verify,/police/forgot-password,/police/reset-password)alembic/script.py.makoto always includeimport src.core.typesso future autogenerated migrations don't need it added manuallyCloses #437