NextMyDay/internal/core/server
Claus Lohmar 7c1826e115 fix(setup): render the TOTP step instead of the enroll flow's JSON
The first-run wizard's `admin.totp.begin` delegated to the enroll flow's
`TOTPBegin`, which is `webauthn.js`'s JSON API: the browser was shown raw
`{"otpauth_url":…}` and the wizard stalled at step 2, rendering no secret.

Extract the issue step into a write-free seam, `flow.Actions.IssueTOTP`, and
keep `TOTPBegin`'s JSON contract by having it call the seam. The wizard now
issues via the seam and renders its own HTML page (`text/html`, inside the
shell, no inline scripts) showing the otpauth URL, the human-readable secret
for manual entry, and the verify form (pre-session CSRF, A15).

`setup.Enroller` drops `TOTPBegin` — the wizard no longer calls it, and a
JSON-writing method on a no-JS seam is the coupling that caused the bug.

Tighten the tests that missed it: `setup_wizard_test.go` asserts the `begin`
response is `text/html` and carries the secret and the verify form (not merely
200), keeping the end-to-end begin→code→303 path; `enroll_login_test.go` pins
the enroll flow's JSON contract (`application/json` + `otpauth_url`).

Spec: docs/specs/spec-005-setup-wizard.md §11.
2026-10-15 07:07:31 +00:00
..
authflow.go feat(core): add the store, identity plumbing and the door (SPEC-003/004) 2026-10-14 10:53:51 +00:00
enroll_login_test.go fix(setup): render the TOTP step instead of the enroll flow's JSON 2026-10-15 07:07:31 +00:00
handlers.go feat(core): add the store, identity plumbing and the door (SPEC-003/004) 2026-10-14 10:53:51 +00:00
recoveryflow.go feat(core): add the store, identity plumbing and the door (SPEC-003/004) 2026-10-14 10:53:51 +00:00
registry.go feat(core): add the store, identity plumbing and the door (SPEC-003/004) 2026-10-14 10:53:51 +00:00
requestcontext.go feat(core): add the store, identity plumbing and the door (SPEC-003/004) 2026-10-14 10:53:51 +00:00
roles.go feat(core): add the store, identity plumbing and the door (SPEC-003/004) 2026-10-14 10:53:51 +00:00
roles_test.go feat(core): add the store, identity plumbing and the door (SPEC-003/004) 2026-10-14 10:53:51 +00:00
server.go feat(setup): gate setup with the config toggle and an optional code 2026-10-15 06:47:33 +00:00
server_test.go feat(setup): gate setup with the config toggle and an optional code 2026-10-15 06:47:33 +00:00
setup_code_test.go feat(setup): gate setup with the config toggle and an optional code 2026-10-15 06:47:33 +00:00
setup_wizard_test.go fix(setup): render the TOTP step instead of the enroll flow's JSON 2026-10-15 07:07:31 +00:00
setupflow.go feat(setup): gate setup with the config toggle and an optional code 2026-10-15 06:47:33 +00:00
spec006_passkey_nudge_test.go fix(security): gate /setup per request and pin the setup module 2026-10-14 11:30:13 +00:00
spec007_recovery_test.go feat(server): gate /setup by the direct tunnel and trust the proxy scheme 2026-10-15 05:40:36 +00:00
spec008_modules_test.go feat(core): add the store, identity plumbing and the door (SPEC-003/004) 2026-10-14 10:53:51 +00:00
spec009_web_pwa_test.go feat(core): add the store, identity plumbing and the door (SPEC-003/004) 2026-10-14 10:53:51 +00:00
static.go feat(core): add the store, identity plumbing and the door (SPEC-003/004) 2026-10-14 10:53:51 +00:00