web: Fix duplicate Turnstile widgets after extended idle#21380
web: Fix duplicate Turnstile widgets after extended idle#21380GirlBossRush merged 2 commits intomainfrom
Conversation
✅ Deploy Preview for authentik-storybook ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for authentik-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #21380 +/- ##
==========================================
+ Coverage 92.59% 92.62% +0.02%
==========================================
Files 1023 1023
Lines 58904 58904
Branches 1791 1791
==========================================
+ Hits 54545 54561 +16
+ Misses 4310 4294 -16
Partials 49 49
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
b5d4ee2 to
d129376
Compare
|
authentik PR Installation instructions Instructions for docker-composeAdd the following block to your AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-f30353ea53ed1b68323161e9087fc0af4224508a
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)sAfterwards, run the upgrade commands from the latest release notes. Instructions for KubernetesAdd the following block to your authentik:
outposts:
container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
global:
image:
repository: ghcr.io/goauthentik/dev-server
tag: gh-f30353ea53ed1b68323161e9087fc0af4224508aAfterwards, run the upgrade commands from the latest release notes. |
✅ Deploy Preview for authentik-integrations ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
91aa182 to
f30353e
Compare
|
|
* Flesh out turnstile fixes. * format Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: Jens Langhammer <jens@goauthentik.io> Co-authored-by: Jens Langhammer <jens@goauthentik.io>
|
🍒 Cherry-pick to |
…#21380 to version-2026.2) (#21473) web: Fix duplicate Turnstile widgets after extended idle (#21380) * Flesh out turnstile fixes. * format --------- Signed-off-by: Jens Langhammer <jens@goauthentik.io> Co-authored-by: Teffen Ellis <592134+GirlBossRush@users.noreply.github.com> Co-authored-by: Jens Langhammer <jens@goauthentik.io>
…k#21380) * Flesh out turnstile fixes. * format Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: Jens Langhammer <jens@goauthentik.io> Co-authored-by: Jens Langhammer <jens@goauthentik.io>
…k#21380) * Flesh out turnstile fixes. * format Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: Jens Langhammer <jens@goauthentik.io> Co-authored-by: Jens Langhammer <jens@goauthentik.io>
* Flesh out turnstile fixes. * format Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: Jens Langhammer <jens@goauthentik.io> Co-authored-by: Jens Langhammer <jens@goauthentik.io> (cherry picked from commit 59ac8ba)
Picks up the non-PR-#21380 changes to captcha files that are already on main: `.style-scope` selector variants in CaptchaStage.css (from #20134) and `export default CaptchaStage` (from #20397). Both are functionally inert on this branch — no code applies the style-scope class to ak-stage-captcha, and no importer uses the default export — but including them keeps the cherry-pick zero-drift against main.
* Flesh out turnstile fixes. * format Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: Jens Langhammer <jens@goauthentik.io> Co-authored-by: Jens Langhammer <jens@goauthentik.io> (cherry picked from commit 59ac8ba)
Picks up the non-PR-#21380 changes to captcha files that are already on main: `.style-scope` selector variants in CaptchaStage.css (from #20134) and `export default CaptchaStage` (from #20397). Both are functionally inert on this branch — no code applies the style-scope class to ak-stage-captcha, and no importer uses the default export — but including them keeps the cherry-pick zero-drift against main.
* Flesh out turnstile fixes. * format Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: Jens Langhammer <jens@goauthentik.io> Co-authored-by: Jens Langhammer <jens@goauthentik.io> (cherry picked from commit 59ac8ba)
Picks up the non-PR-#21380 changes to captcha files that are already on main: `.style-scope` selector variants in CaptchaStage.css (from #20134) and `export default CaptchaStage` (from #20397). Both are functionally inert on this branch — no code applies the style-scope class to ak-stage-captcha, and no importer uses the default export — but including them keeps the cherry-pick zero-drift against main.
* Flesh out turnstile fixes. * format Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: Jens Langhammer <jens@goauthentik.io> Co-authored-by: Jens Langhammer <jens@goauthentik.io> (cherry picked from commit 59ac8ba)
Picks up the non-PR-#21380 changes to captcha files that are already on main: `.style-scope` selector variants in CaptchaStage.css (from #20134) and `export default CaptchaStage` (from #20397). Both are functionally inert on this branch — no code applies the style-scope class to ak-stage-captcha, and no importer uses the default export — but including them keeps the cherry-pick zero-drift against main.
…#21380 to version-2025.12) (#21472) * web: Captcha Refinements, Part 2 (#19757) * Move inline styles into separate file. * Fix preferred order of captcha vendor discovery. * Clean up mutation and resize observer lifecycle. * Flesh out controllers. * Tidy refresh. * Fix incompatibilities with Storybook. * Flesh out captcha stories. * Bump package. * Flesh out stories. * Move inline styles into separate file. * Fix preferred order of captcha vendor discovery. * Clean up mutation and resize observer lifecycle. * Flesh out controllers. * Tidy refresh. * Remove unused. * Bump package. (cherry picked from commit 388f426) * web: Fix duplicate Turnstile widgets after extended idle (#21380) * Flesh out turnstile fixes. * format Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: Jens Langhammer <jens@goauthentik.io> Co-authored-by: Jens Langhammer <jens@goauthentik.io> (cherry picked from commit 59ac8ba) * web: align captcha stage with post-21380 main drift Picks up the non-PR-#21380 changes to captcha files that are already on main: `.style-scope` selector variants in CaptchaStage.css (from #20134) and `export default CaptchaStage` (from #20397). Both are functionally inert on this branch — no code applies the style-scope class to ak-stage-captcha, and no importer uses the default export — but including them keeps the cherry-pick zero-drift against main. * bump. * Enforce strict tsconfig version. Format. * Fix linter warning. --------- Signed-off-by: Jens Langhammer <jens@goauthentik.io> Co-authored-by: Teffen Ellis <592134+GirlBossRush@users.noreply.github.com> Co-authored-by: Jens Langhammer <jens@goauthentik.io>
Details
Turnstile's client-side script includes a self-upgrade mechanism that periodically replaces its own
<script>tag with a fresh version. When the upgraded script loads, it restores its internal widget state and then re-scans the DOM for.cf-turnstileelements to implicitly render — even though those containers already have an active widget. This results in duplicate widgets accumulating over time.This PR changes our Turnstile controller from implicit rendering (via the cf-turnstile class and data-* attributes), to explicit rendering (
?render=expliciton the script URL + a manualturnstile.render()call). With explicit mode, the self-upgrade cycle no longer triggers a DOM scan, so existing widgets aren't duplicated.Closes #18156