Feelcouch ProjectsHandbook · v1.47.0

Guides

Account access and optional synthetic email links

The released account contract is account access: email/password login at /login, invitation registration, separate credential changes at /account/access, and eight one-use offline backup codes at /recover-access. Email is a login identifier, not proof that its mailbox has been verified. Existing Telegram identity, participant history and account permissions are preserved. Password recovery and credential changes revoke older sessions and unused recovery material.

Production behavior

Production magic links are unavailable. EMAIL_AUTH_ENABLED=true alone does not enable mail delivery or bypass the password flow. The older draft MTA/sendmail path is not used. Invitation SMTP remains the independent optional transport described in invitation email delivery; it does not turn an unverified account identifier into a trusted password-reset destination.

Canonical storage and migrations remain unchanged: 20261001120000_email_fallback stores password credentials and manually issued recovery tokens; 20261001170000_account_recovery_codes stores only SHA-256 hashes of eight 128-bit backup codes. Codes do not expire by time, but a new batch, credential change, logout-all or successful recovery revokes them. Recovery requires the established email, a code and a strong new password; it never changes email or roles.

The legacy /account/security route redirects to /account/access outside the synthetic demo. The operator compatibility command node --import tsx scripts/bootstrap-recovery.ts --user-id <existing-admin-id> requires an interactive terminal and the active administrator's existing password. Input is not echoed or placed in arguments; codes print once to that terminal. It rotates codes, does not bootstrap a lost account, and offers no operator password bypass. Prefer the browser's masked form at /account/access. Never invoke this command through CI, a recording terminal or a logging job.

Optional isolated demonstration

The draft email-link feature is retained only for the explicitly isolated synthetic hosted preview. It additionally requires EMAIL_AUTH_ENABLED=true, PLATFORM_DEMO_MAILBOX=true, all hosted-preview/synthetic isolation flags and a trusted HTTPS origin allowlist. The preview rejects configured real SMTP or Telegram delivery. Both issuing and consuming links fail closed outside this deployment; only active synthetic users and .test destinations are eligible.

20261001180000_optional_demo_email_links additively supplies User.verifiedEmail and EmailAuthChallenge. It creates no second recovery-code table and changes no released migration. The dedicated lib/auth/email-links.ts engine stores scoped HMACs, expiry and one-use claim state. Messages remain in a bounded, short-lived in-process synthetic inbox; no outbound mail is sent. Verification must be completed in the same authenticated account that requested it. GET previews cannot consume a link; explicit POST is required. Consumption rejects replay, inactive/blocked users, wrong tenant origin/purpose and challenges issued before the current session-revocation boundary. Newly authenticated demo sessions use the shared monotonic issuance helper.

/login/email and the demo security page show this simulated capability. It is not evidence that a real mailbox has been verified or that real password-reset delivery has been activated. Real email-link authentication requires a separately reviewed verification/destination lifecycle before production enablement.

Redact /login/email query strings in proxy/access logs, keep tenant session secrets distinct, and use host-only signed cookies. The confirmation page sets no-referrer/noindex. Expired/consumed challenge retention remains an operator policy; account deletion cascades to its challenge rows.