Skip to content

Hosted two-factor sign-in: Settings, Sign-in per team, held screen, Security, docs - #243

Merged
nambok merged 1 commit into
mainfrom
feat/hosted-team-2fa
Oct 27, 2026
Merged

nambok merged 1 commit into
mainfrom
feat/hosted-team-2fa

Conversation

@nambok

@nambok nambok commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

The dashboard and docs for two-factor sign-in on hosted CoderHelm. Backend: CoderHelm/coderhelm-platform#332.

  • Settings, Sign-in now opens on hosted for admins and owners, under Team.
    • "Require two-factor sign-in for this team", with how many people haven't set it up (for example "1 of 3 people hasn't set it up yet").
    • A confirmation that says those people will be emailed, and a toast saying how many were.
    • The list of who has it, and a reset dialog. On hosted the dialog says the reset reaches every team the person is on and that they get an email.
    • Self-hosted installs keep the "Who may join" section. Hosted has no domains.
  • Held screen on hosted. A session held by its team's rule sees only the setup screen ("This team requires two-factor sign-in"). Someone whose factor is on their password account and who signed in with Google or GitHub is told to sign in with their email and password.
  • No extra request on hosted. The shell learns a session is held from the server's own two_factor_required answer: on the usage call it already makes at load, and on any later request. A session that isn't held makes no extra call (a test checks this). Self-hosted still asks up front, as before.
  • Settings, Security on hosted:
    • Google and GitHub accounts get the authenticator-app code section.
    • Turning a factor off is hidden while a team they're on requires it ("A team you're on requires it, so it stays on").
    • A factor on the password account is explained after Google or GitHub.
    • A password account with the app code doesn't offer a second factor on top of it.
    • Turning off the password account's code from a session that didn't use it says to sign in again with the code first.
  • Docs:
    • a new page, Concepts, Sign-in and two-factor (/concepts/sign-in/), for hosted;
    • sign_in added to the roles table;
    • a "Two-factor sign-in" card on the site's Security page.

Changes

  • dashboard/src/app/settings/sign-in/page.tsx: hosted mode (no domains section, team wording, the without-a-second-factor line, the notified toast, reset wording).
  • dashboard/src/components/settings-items.tsx: Sign-in is no longer self-host only.
  • dashboard/src/components/client-shell.tsx: the held check on hosted comes from two_factor_required answers. TwoFactorGate uses the team's wording and treats any factor the person already has as "sign in again".
  • dashboard/src/lib/api.ts:
    • TWO_FACTOR_REQUIRED event from request;
    • must_keep on MyTwoFactor;
    • without_2fa on SignInSettings;
    • notified on the update answer.
  • dashboard/src/app/settings/security/page.tsx: the hosted two-factor section and the cases above.
  • dashboard/e2e/hosted-2fa.spec.ts (new): 9 tests at 1440 and 390. They cover the settings, the confirmation and its email count, the reset, the switch waiting for the admin's own code, the hub entry, the held screen and finishing setup from it, no extra call when not held, Security after Google (kept on, off, factor on the password account), and the code step after Google.
  • docs/content/docs/concepts/sign-in.mdx (new), concepts/meta.json, concepts/roles.mdx, published-pages.json.
  • src/content/site.ts: the Security page card.

Verification

  • Dashboard: npm run typecheck, npm run lint, npm run check:openapi (matches the platform) and npm run build: clean.
  • E2E:
    • after rebasing on main, 110 passed: hosted-2fa.spec.ts (18), sign-in-2fa.spec.ts, audit-shell.spec.ts, run-questions.spec.ts, settings-pages.spec.ts and settings.spec.ts;
    • before the rebase, shell nav, API keys, capabilities and mobile sign-in also passed.
    • selfhost.spec.ts "Setup: failing checks..." fails the same way on main (3 check runs, expects 2), so this change didn't cause it. A layout test that timed out once passed on rerun.
  • Screenshots reviewed at 1440 and 390: settings, the confirmation, the reset dialog, the held screen, Security after Google (on and off) and the code step. Nothing scrolls sideways.
  • Site: npm run lint (warnings only, none new) and npm run build: clean.
  • Docs: npm run test:unit (86 passed), npm run build, npm run typecheck, npm run check:links (5137 internal links, none broken) and npm run check:output: clean.
  • The diff has no customer names and no arrow glyphs.

…ecurity, docs

Settings, Sign-in opens on hosted with the team's switch, how many people
have no second factor, the email notice and a reset that reaches every
team. The shell learns a held session from the server's two_factor_required
answer, so sessions that aren't held make no extra call. Security shows the
app code after Google or GitHub and keeps it on while a team requires it.
New docs page Concepts, Sign-in and two-factor, and a card on the Security
page.
@nambok
nambok force-pushed the feat/hosted-team-2fa branch from 5ea2887 to d9ef6a0 Compare October 27, 2026 18:11
@nambok
nambok merged commit 230b5b5 into main Oct 27, 2026
5 checks passed
@nambok
nambok deleted the feat/hosted-team-2fa branch October 27, 2026 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant