Password reset
User flow
Section titled “User flow”- Login page → “Forgot password?”
- Enter email. Submit.
- z4j always responds “check your email” regardless of whether the email exists (prevents enumeration).
- If the email exists, a one-shot reset link is sent. Token expires in 60 minutes.
- User clicks → new-password form → new password enforced by password policy.
- On save, all existing sessions for that user are invalidated.
Requires SMTP
Section titled “Requires SMTP”Password reset requires SMTP. Without it, users cannot self-serve; admins must reset via CLI (see below).
Rate limits
Section titled “Rate limits”- Max 3 reset requests per email per hour.
- Max 10 reset requests per IP per hour.
Admin-reset (CLI)
Section titled “Admin-reset (CLI)”For lost admin accounts or SMTP outages:
z4j-brain password-reset --email owner@example.comThe CLI prints a one-shot reset URL (bypasses SMTP). Use it to set a new password.
Requires direct brain-container access.
Last-resort recovery
Section titled “Last-resort recovery”If you’ve lost all admins and CLI access:
- Connect to Postgres directly.
- Generate an argon2id hash with an external tool (e.g.,
argon2 --encoded). UPDATE users SET password_hash = '$argon2id$...' WHERE email = 'owner@example.com'.- Log in with the new password.
This is a break-glass procedure - log the event externally and treat it as a compromise drill.
- Reset requested → audit entry with just the email + IP (not the token).
- Reset completed → audit entry with
user_id.