Files
5def7a7497 web/flows: never let continuous login block the final redirect (#26269)
* never let continuous login block the final redirect

The final redirect awaits continuous-login orchestration and the exit
bookkeeping before navigating, so any error or hang there leaves the
page on the spinner after the server has already finished the flow.
In Google's Android account setup WebView, localStorage is null and
the orchestrator throws (#23660, #26267).

- Catch and log orchestration errors in RedirectStage, then always
  navigate.
- Return a copy from discoverTabs(). waitForTabExit() rediscovers
  while the leader iterates the live Set, and entries re-added during
  for...of are visited again, so a follower that never exits was
  resumed forever.
- Resolve the wait when rediscovery rejects in the timer callback, and
  release the tab lock in a finally block.

* web/flow: elect continuous-login resume leader with a Web Lock

Replace the hand-rolled localStorage lock — a non-atomic check-then-set
guarded by a tab-liveness heuristic — with navigator.locks. `ifAvailable`
gives immediate leader election with no double-leader race, and the
browser releases the lock on navigation or close, so there is no stale
lock to reap and no manual cleanup.

* web/test: cover continuous-login multi-tab resume

Drive two real tabs in one browser context: authenticate in the leader
and assert the follower leaves the identification stage on its own. The
global flag is enabled in beforeAll and restored in afterAll; the file
carries the highest numeric prefix and runs serially so it does not race
the parallel login suite.

* Refine comments.

* web/test: align continuous-login e2e with suite conventions

Move the global-flag toggle into an e2e/ helper (setInstanceFlag) so the
test stops hand-constructing fixtures inline, and confirm the settings
save through its success toast instead of matching the settings network
response — keeping the flow on the UI like the rest of the suite.

* web/test: pad the continuous-login visibility assertions

* web/flow: rework continuous-login unit tests around the Web Lock

* web/test: wait for each tab to see the continuous-login flag

* web: share server-context document readers via @goauthentik/core/document

* web/flow: share a brand injection helper across continuous-login tests

* Clean up comment.

---------

Co-authored-by: Teffen Ellis <[email protected]>
Co-authored-by: Teffen Ellis <[email protected]>
2026-10-27 18:31:14 +00:00
..
2026-03-26 13:34:48 +01:00