Sign-in & shared code
Reset password
| Path | /reset-password |
|---|---|
| Status | live |
| Drill-down pages | — |
| Pop-ups | — |
| Tabs | — |
| API routes | /api/auth/reset-password |
Business rules
Data comes from: dh_users. Server: POST /api/auth/reset-password.
How it works:
- Needs the token from the email (reset type, not expired) and a new password: at least 6 characters, at most 200 (the same rule as invite set-up).
- Saves the new password and clears the lockout (failure count, window, locked until). If the login was locked, the unlock goes to the Audit Log.
- Each link works once, and only for an active login. It also stops working when the password is changed any other way. The check and the save are one database write, so two clicks can't both succeed.
- A bad, used or expired link answers "Invalid or expired reset link".
- The page reads the token from the link, then removes it from the address bar and browser history.
- New password: 6 to 200 characters, checked on the page and on the server.
Database tables & columns
| Table | Columns used |
|---|---|
dh_users | failed_login_count, failed_login_window_start, id, locked_until, password_changed_at, password_hash, status, updated_at |
File structure
Its own files
- apps/
- web/
- src/
- pages/
- ResetPassword.tsx
- pages/
- src/
- web/
Shared code it uses (followed through its imports and the helpers its API calls; sign-in/access plumbing and UI primitives left out)
- apps/
- web/
- src/
- services/
- api.ts
- services/
- src/
- worker/
- src/
- routes/
- auth.ts
- services/
- session.ts
- staff-onboarding.ts
- utils/
- jwt-key.ts
- password.ts
- routes/
- src/
- web/