Sign-in & shared code

Forgot password

Path/forgot-password
Statuslive
Drill-down pages—
Pop-ups—
Tabs—
API routes/api/auth/forgot-password

Business rules

Data comes from: dh_users. The email uses the auth_password_reset template (email_templates) and is recorded in email_sends. Server: POST /api/auth/forgot-password.

How it works:

  • Always answers "If an account exists, a reset link has been sent", so nobody can find out which emails have logins.
  • Only active logins get a link. Inactive logins can't sign in anyway, and invited logins set their password from their invite email. The answer is the same in every case.
  • The link holds a reset token valid for 1 hour.
  • Each IP may ask 5 times a minute (see Rate limits).

Database tables & columns

TableColumns used
dh_usersemail, id, name, status
email_sendsapp, error, lang, provider, recipients, ref, sent_by, status, subject, subject_encrypted, template_key, to_email, to_email_encrypted, to_email_hash
email_templatesactive, bcc_emails, body_en, body_es, from_email, key, reply_to, subject_en, subject_es, to_emails

File structure

Its own files

  • apps/
    • web/
      • src/
        • pages/
          • ForgotPassword.tsx

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
    • worker/
      • src/
        • db/
          • index.ts
        • routes/
          • auth.ts
        • services/
          • email-templates.ts
        • utils/
          • email.ts
          • jwt-key.ts