Skip to content

Hosted login: wait for Turnstile before sending, and fit phone screens - #47

Merged
s3rot0n1n merged 2 commits into
mainfrom
fix/turnstile-gate-email-button
Nov 22, 2026
Merged

s3rot0n1n merged 2 commits into
mainfrom
fix/turnstile-gate-email-button

Conversation

@s3rot0n1n

@s3rot0n1n s3rot0n1n commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Two fixes to the hosted login and consent pages in packages/oauth-server-kit.

1. The email button waits for Turnstile

Bug: Continue with email was enabled while the Turnstile check was still running. Clicking before it finished showed "Complete the security check, then try again."

Fix:

  • Initial state: when a captcha is configured, the button renders disabled.
  • Turnstile callbacks: data-callback enables it. data-expired-callback, data-error-callback and data-timeout-callback disable it.
  • After a send: the button is disabled while the request is in flight. With a captcha, the widget resets after each send and the button waits for a new token. Without one, it's enabled again.
  • Unchanged: the submit-time token check stays as a backstop.

2. Phone screens

Bug:

  • Overflow: Turnstile's flexible widget is at least 300 px wide. With 24 px page and 32 px card padding, a 375 px screen left 263 px, so the card ran past the screen edge and the page scrolled sideways (scroll width 390 on a 375 viewport).
  • Zoom: inputs used 15 px text, so iOS Safari zoomed in on focus.

Fix:

  • Under 420 px: the page padding is 16 px and the card padding is 24 px × 18 px.
  • Under 360 px: the card drops its frame.
  • Inputs: text is 16 px.

Tests

  • New unit tests cover the button state (disabled at load, enabled on success, disabled on clear and after a send) and the phone CSS. All 141 tests pass, and check-types and biome are clean.
  • Real browser, with Cloudflare's test keys:
    • with the forced-interactive key, the button stays disabled with no token;
    • with the always-pass key, the token is set and the button is enabled;
    • at 375 px, no sideways scroll, the card spans 16–359 px and the widget 35–340 px;
    • at 320 px, no sideways scroll, everything spans 10–310 px.

🤖 Generated with Claude Code

The hosted login page enabled "Continue with email" while the Turnstile
check was still running, so a quick click showed "Complete the security
check, then try again." The button now renders disabled when a captcha
is configured. Turnstile's success callback enables it, and its expired,
error and timeout callbacks, as well as the reset after each send,
disable it again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-22T09:48:21.175755Z 4d293cf PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Turnstile's flexible widget is at least 300px wide. With 24px page and
32px card padding, a 375px screen left 263px, so the card ran past the
screen edge and the page scrolled sideways. Under 420px the padding
shrinks, and under 360px the card drops its frame. Inputs use 16px text
so iOS Safari doesn't zoom in on focus.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@s3rot0n1n s3rot0n1n changed the title Disable the email button until Turnstile returns a token Hosted login: wait for Turnstile before sending, and fit phone screens Nov 22, 2026
@s3rot0n1n
s3rot0n1n merged commit 1ca756a into main Nov 22, 2026
1 check passed
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