Repository navigation
web: Fix duplicate Turnstile widgets after extended idle (cherry-pick #21380 to version-2025.12) - #21472
Conversation
✅ Deploy Preview for authentik-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for authentik-integrations 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 @@
## version-2025.12 #21472 +/- ##
================================================
Coverage 93.31% 93.31%
================================================
Files 947 947
Lines 52936 52936
================================================
+ Hits 49397 49399 +2
+ Misses 3539 3537 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
9ccaad0 to
616012e
Compare
|
authentik PR Installation instructions Instructions for docker-composeAdd the following block to your AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-0449366be48e7239a53802f7ae6731f612678ac4
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-0449366be48e7239a53802f7ae6731f612678ac4Afterwards, run the upgrade commands from the latest release notes. |
dad9215 to
6523a8e
Compare
|
depends on #21788 to fix the CI |
* 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)
* Flesh out turnstile fixes. * format Signed-off-by: Jens Langhammer <[email protected]> --------- Signed-off-by: Jens Langhammer <[email protected]> Co-authored-by: Jens Langhammer <[email protected]> (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.
bdb8465 to
0449366
Compare
Details
This PR back ports #21380 and the prerequisite #19757 into version 2025.12. A third commit aligns two lingering cosmetic drifts.
Commits
3a1d99bbcontrollers/9e6631329ccaad0cCommit 1: Prerequisite
controllers/turnstile.tsdoesn't exist onversion-2025.12— it's created by #19757, which extracted captcha provider logic into acontrollers/directory with a sharedCaptchaControllerbase. Without #19757, the fix has nothing to modify.The prerequisite commit is the squash merge from
mainapplied as-is. Groups of files:Captcha refactor (the point of #19757)
web/src/flow/stages/captcha/CaptchaStage.ts— migrated toCaptchaHandlerHost/#refreshControllers()patternweb/src/flow/stages/captcha/CaptchaStage.css— styles extracted from inlineweb/src/flow/stages/captcha/shared.ts— iframe template extractedcontrollers/CaptchaController.ts,controllers/grecaptcha.ts,controllers/hcaptcha.ts,controllers/turnstile.ts,controllers/shared.ts— new per-provider controllersgrecaptcha.ts,hcaptcha.ts,turnstile.tsfiles (moved intocontrollers/)Captcha Storybook stories (also from #19757)
stories/grecaptcha.stories.ts,stories/hcaptcha.stories.ts,stories/turnstile.stories.ts— addedCaptchaStage.stories.ts— deleted (replaced by the per-provider stories)Storybook / bundler plumbing needed by those new stories
.storybook/main.js,.storybook/preview.js— config updatesbundler/utils/node.js,types/esbuild.d.ts— asset import shimspackage.json,package-lock.json— Storybook dep bumpsstyles/authentik/storybook.css,stories/flow-interface.ts— shared story shellTouched-by-refactor (non-captcha) — these are the spill-over from the refactor that happened to co-land in #19757. None change runtime behavior outside what #19757 already validated on
main:common/api/middleware.ts,common/theme.ts,common/types.ts,common/ui/locale/*— locale/theme plumbing used by the new story shellelements/controllers/LocaleContextController.ts,elements/mixins/locale.ts,elements/messages/MessageContainer.tsflow/FlowExecutor.ts,flow/FlowExecutor.stories.ts,flow/components/ak-flow-card.ts,flow/components/types.ts(new)*Stage.stories.tsfiles — updated to match the new story shellCommit 2: Backport
Turnstile's client-side script periodically self-upgrades, re-scans the DOM for
.cf-turnstileelements, and renders duplicate widgets over time. This PR switches from implicit rendering to explicit rendering (?render=explicit+ manualturnstile.render()) so the self-upgrade cycle no longer triggers a DOM scan.Three files, all in
web/src/flow/stages/captcha/:CaptchaStage.ts— 1 linecontrollers/turnstile.ts— 30/-14shared.ts— 10/-2Commit 3: Drift alignment
Two tiny cosmetic drifts:
CaptchaStage.cssak-stage-captcha.style-scopeselector variants (4 lines)CaptchaStage.tsexport default CaptchaStage;(1 line)Both are functionally inert on
version-2025.12— no code applies thestyle-scopeclass toak-stage-captcha, and no importer uses the default export — but including them means the captcha tree in this PR is byte-for-byte identical tomain. Full #20134 (+460/-229, 18 files, layout refactor) and #20397 (+58, 28 files, every flow stage) were deemed out-of-scope for a release-branch hotfix.Verified with
git diff main..HEAD -- web/src/flow/stages/captcha/→ empty.Test plan
npm run lint:types— no new type errors vsversion-2025.12baseline (verified locally: 26 → 23, the 3 differences are captcha story errors that the refactor fixes)npm run storybook)