oliver-zehentleitner / maity

forgot password: web part (after contract #1648)

Sign in to report

tsk-yksxdpd2pk0m Done An agent

The web half of tsk-pk755085ctff (Oliver: mail-only 2FA may reset itself, option c; TOTP nudge; confirmed 109283). It builds on the contract text from #1648 (§2.10), so it starts after #1648 merges. Plan, review and evidence as usual. The parent card closes when the contract, hub and web parts are all done.

Notes

  1. An agent · Nov 12, 2026, 18:09 UTC

    Plan (zwhq) for the web half of §2.10 (the hub half is #1684/#1685, merged). I propose two web PRs.

    PR A: reset by mail

    1. "Forgot password?" on the login page (js/app.js renderLogin). It is shown only when GET /auth/methods says password_reset. It opens an address field in place (same page, no route of its own). POST /auth/password-reset always gives the same sentence: "If this address can reset a password here, a link is on its way; it is valid for 30 minutes." The page never says whether the address exists. A refusal (method_disabled, maintenance) shows the hub's message.
    2. The page `/sign-in/reset#<token>`, new web/js/password-reset.js. It is drawn before the session read, like /invite and /register, so it works signed in or out. The token is read from the fragment and removed from the address bar before anything is drawn.
    • check → "Set a new password for <name> (<handle>)". Then:

    - factor: totp → a code field with "Use a recovery code";
    - factor: email → the contract's sentence about the mailbox being the second factor too, with the way to Security;
    - null → nothing more.

    • complete → "Your password is set. Every session has ended." plus a link to the login. It signs nobody in.
    • code_invalid → one sentence that does not say which reason (the link no longer works or the code was wrong), with "Request a new link" back to the login's form.
    • too_short, method_disabled and maintenance are each said as for the other sign-in pages.
    1. Own switch in the mail settings (js/notify-settings.js): email.password_reset beside "Allow a sign-in link by mail". Its sentence follows the human's factor (without TOTP: "Turn this off if an agent or anyone else can read this mailbox…"; with TOTP: "A reset by mail also needs a code from your authenticator app"). Only what changed is sent; the PATCH validation goes in api.js.
    2. Instance switch: password_reset in the admin's sign-in settings (js/admin-sign-in.js), with a sentence saying that turning it off voids every open link.
    3. The fixtures mock (api.js) for the four calls, plus i18n in 10 languages.

    PR B: banner toward an authenticator app

    • For via: email in GET /auth/second-factor, on every dashboard page, linking to Security.
    • It has the contract's two texts. The first is used when a reset by mail could reach the human: the instance offers it, the own switch is on, and they have a password.
    • "Later" hides it until the next sign-in: the session_id of GET /auth/session is kept in localStorage (try/catch; without storage the banner just shows again). Enrolling TOTP ends it.

    Both PRs

    • smoke tests.
    • e2e against the real hub with the mail catcher: request → mail → link → new password → the old sessions ended → sign in with the new one; a TOTP account (code asked, a wrong code is code_invalid, a recovery code works); a mail-factor account (the sentence, and in B the banner). Shots at 1280 and 390.
    • docs/humans.md (forgot password, the switch, the banner), docs/api.md (§2.10's "Pending" removed or narrowed, a route-table row for /sign-in/reset), web/README.md, a web/context entry (the page before the session read; "Later" per session), changelog.

    Why two PRs: A is the way back into an account; B touches every page's header area, so each stays reviewable. With a go I start with A.