screentinker/server
screentinker 1e99582193
Keep every field on screen during first-run setup (#287)
On a fresh install with no users, typing an email address made the password
field disappear.

Identifier-first login asks the server which identity provider an address uses
before offering a credential, so someone whose organization requires its own
IdP is never shown a password box that will be refused. First-run setup opted
out of that by setting `identified = true` up front - there is nobody to
identify, the operator is creating the first account - and then the "editing
the address returns to the identifier step" listener fired on the very first
keystroke, set it back to false, and re-rendered. Password gone, mid-typing.
The same re-render also replaced "Create admin account" on the button with
"Sign in" and then "Next".

Initialising a flag to the right value is not the same as the flow being
inert: any later event could undo it, and one did. The decision now lives in
frontend/js/lib/login-form-state.js as a pure function that ignores
`identified` and `ssoOnlyDomain` entirely when there are no users, so no event
can take a field away. The input listener also returns early during setup,
which additionally stops it spending an org-lookup rate-limit budget that has
nothing to answer.

Two assertions in login-identifier-first.test.js pinned those expressions to
their old address inside login.js. Their intent - "the two drivers must be
combined in one place so they cannot disagree" - is better served by the
extracted module, so they now follow the logic there rather than being
loosened.

Verified: the extracted pre-fix logic returns showPassword=false and
buttonKey=auth.next for setup-plus-one-keystroke, which is the reported
symptom exactly; the new truth table covers it. i18n/login/auth/session/sso
suites go from 108 to 116 passing, none failing.

Not addressed here, and worth its own change: loadAuthConfig() has no error
handling and caches its first result, so a /api/auth/config that fails leaves
needsSetup undefined and the form falls back to the restrictive layout - the
same visible symptom from a different cause.


Claude-Session: https://claude.ai/code/session_014kfhrUPit5MCqxeTQyqr56

Co-authored-by: Dan Walters <dan.walters@bytetinker.net>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-18 14:50:54 -05:00
..
config fix(logging): gate CF-Connecting-IP on a Cloudflare peer, not any trusted proxy 2026-07-26 10:23:04 -05:00
db Opt-in install statistics (#267) 2026-08-13 17:27:10 -05:00
lib Check what is IN a cached update, and add a way to throw it away (#274) 2026-08-14 08:37:05 -05:00
middleware Merge branch 'fix/recovery-grants' into release/auth-campaign 2026-07-26 16:22:59 -05:00
player Add org-level widget sandbox isolation toggle with warnings 2026-08-10 21:14:42 +00:00
routes Merge Japanese localisation (#283) (#285) 2026-08-18 09:23:28 -05:00
scripts Drop sharp: pure-JS image ops on a worker thread (#263) 2026-08-13 11:40:13 -05:00
services #240: stop the morning wave buying itself a blocking checkpoint 2026-08-06 20:22:21 -05:00
test Keep every field on screen during first-run setup (#287) 2026-08-18 14:50:54 -05:00
ws Add org-level widget sandbox isolation toggle with warnings 2026-08-10 21:14:42 +00:00
.gitignore feat(email): Microsoft Graph send + alert spam protection + preferences UI 2026-05-12 18:16:40 -05:00
config.js SSO: prove domain ownership by DNS, and fix what the second review found 2026-08-10 19:23:46 -05:00
node_modules Merge Japanese localisation (#283) (#285) 2026-08-18 09:23:28 -05:00
package-lock.json Stop shipping a licence we would rather not have to explain (#281) 2026-08-14 14:50:18 -05:00
package.json Stop shipping a licence we would rather not have to explain (#281) 2026-08-14 14:50:18 -05:00
server.js Fix a load-time crash that took down any install collecting statistics (#279) 2026-08-14 12:17:41 -05:00
smoke-ui.js Keep the smoke test out of npm test, and update the lockfile 2026-07-28 20:34:34 -05:00
version.js chore(version): single-source VERSION, env-configurable data paths, bump tooling 2026-06-10 12:56:03 -05:00