fix(auth): fix Turnstile captcha blocking all logins#3718
fix(auth): fix Turnstile captcha blocking all logins#3718waleedlatif1 merged 1 commit intostagingfrom
Conversation
h-0 w-0 overflow-hidden was clipping the iframe, preventing Turnstile from executing. absolute takes it out of flow without clipping, fixing both the layout gap and the captcha failure.
PR SummaryLow Risk Overview This keeps the captcha out of layout flow while allowing the challenge iframe to execute, unblocking captcha-protected submissions. Written by Cursor Bugbot for commit b7cdc3d. Configure here. |
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR fixes a regression where Cloudflare Turnstile's invisible captcha was being clipped by Changes:
Observations:
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant Form as Login/Signup Form
participant TurnstileDiv as Turnstile Wrapper div
participant TurnstileIframe as Turnstile iframe
User->>Form: Submit credentials
Form->>TurnstileDiv: execute() via ref
note over TurnstileDiv: BEFORE fix: h-0 w-0 overflow-hidden<br/>→ iframe clipped → challenge blocked
note over TurnstileDiv: AFTER fix: absolute<br/>→ out of flow, not clipped
TurnstileDiv->>TurnstileIframe: Execute challenge (now works)
TurnstileIframe-->>Form: Return captcha token
Form->>Form: Include token in auth request
Form-->>User: Login/Signup succeeds
Reviews (1): Last reviewed commit: "fix(auth): use absolute positioning for ..." | Re-trigger Greptile |
|
|
||
| {turnstileSiteKey && ( | ||
| <div className='h-0 w-0 overflow-hidden'> | ||
| <div className='absolute'> |
There was a problem hiding this comment.
absolute without a relative ancestor or positional constraints
The absolute div has no explicit relative positioned parent at the form level (the nearest relative ancestor in the tree is the password input wrapper at line 436). This means the Turnstile wrapper will be positioned relative to whatever positioned ancestor exists further up in the layout tree, which is unpredictable.
For an invisible captcha this is harmless today, but the intent could be made more explicit and defensive by also suppressing pointer events and using overflow-hidden to prevent any edge-case visible challenge from leaking into the layout:
| <div className='absolute'> | |
| <div className='absolute overflow-hidden opacity-0 pointer-events-none'> |
The same concern applies in signup-form.tsx at line 481.
Summary
The invisible Turnstile iframe was wrapped in
h-0 w-0 overflow-hiddento fix a layout gap, but this clipped the iframe and prevented Turnstile from executing challenges. Every login/signup attempt failed with "Captcha verification failed."Replaced with
absolutepositioning which takes the element out of flow (no layout gap) without clipping the iframe, so Turnstile can execute normally.Test plan