Repository navigation
Conversation
Keep the session preference when the stock login form starts OIDC sign-in.
The stock Jellyfin Web login form (10.11.11 and 12.4) starts with a heading div, so the positional fallback .inputContainer:nth-of-type(-n+2) matched only the username wrapper. Engines with constructed stylesheets but no :has() (Chromium 73 to 104, Firefox 101 to 120) adopted that rule, skipped the element fallback and left the password field visible. Adopt the stylesheet only when :has() is supported and let the element fallback hide the exact controls, including on remounts. The rendered tests now use the stock form order.
…e loads The "Sign in with a password instead" link is created with T(), which returns the English fallback while tfa-i18n.js is still loading. Unlike the other injected login elements it carried no data-i18n-key, so the 'tfa-i18n-ready' hook never re-translated it and it stayed English on a non-English Jellyfin. Adapted to the ZL154#364 password gate, which takes the custom label from the per-server config it resolves for the login route, not from _tfaPublicCfg. (cherry picked from commit f300059)
…ogin view jellyfin-web keeps earlier views in the DOM, hidden. Opening login again under a different route (e.g. the header logo -> #/login?serverid=...) builds a second #loginPage while the first one stays hidden. The document-wide id guards then found the nodes injected into the hidden view, so the visible form got no SSO button and no password reveal link until a full reload. Resolve the login view that is on screen, look the form up inside it, and drop injected nodes stranded in a hidden view so they are injected again. Adapted to the ZL154#364 password gate by scoping its reveal link and .manualLoginForm lookups to the visible view, leaving its policy unchanged. (cherry picked from commit 9ad7150)
Jellyfin Web keeps the earlier views of a route in the DOM and hides them. Render two cached login views the way the header logo creates them, then go back and forward with the plugin poll turned off, so every pass comes from the page's own events. After each step the document holds exactly one reveal link and one provider list, both rendered in the visible view, with that view's credentials hidden. The reveal is clicked in the second view, which is not the first match in the document, and must show and focus that view's own fields. Render the reveal link while the German bundle is held back. The default label carries data-i18n-key and reads German once tfa-i18n-ready fires. A custom label carries no key and keeps its text. The document double in stockLoginPage gains setAttribute, which the reveal link now calls. The Chromium runner moves into renderInChromium, shared by the existing rendered modes and the new pages.
…eep a box Jellyfin Web ships its .hide rule as an inline style. Under a style-src 'self' policy the browser blocks it, so the cached login views the router marks .hide keep their layout box. visibleLoginRoot() took the first view with a box, which was the stale one: after the header logo and after Back the provider button and the reveal link stayed there while the selected view had neither. Prefer the first login view without .hide that has a box, since viewContainer leaves only the selected or restored view unmarked, and keep the first view with a box, then the document, as fallbacks. The cached view test now also runs under style-src 'self'.
Contributor
Author
|
I pushed five commits after checking przeniek's report on #362.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When Disable password sign-in applies to the browser's address, the plugin now hides Jellyfin Web's stock username, password and sign-in button before the login form first paints, instead of about half a second after the form has appeared. Jellyfin's Remember Me checkbox stays next to the remaining sign-in options, and a change to it now also applies to OIDC sign-in.
It also carries przeniek's two fixes from #366, cherry-picked with his authorship: the Sign in with a password instead link follows a translation bundle that loads after it, and the reveal link and the SSO buttons go into the login view on screen when Jellyfin Web keeps an earlier login view hidden.
Type of change
Related issues
Fixes #362
Includes the two commits of #366 by przeniek.
How was this tested?
Server tested against: Jellyfin 10.11.11 and 12.4.0 (official Docker images, disposable containers on loopback), with plugin packages built from main (
721b6c0) and from this branch for each ABI.Clients tested with: Jellyfin Web in headless Chromium 159.0.8154.6, driven by a script that sampled every animation frame and tried to focus the password field.
:has()(Chromium 73 to 104, which covers many TV web views, and Firefox 101 to 120), simulated in the same Chromium by rejecting:has()before any page script ran: before the:has()follow-up the password stayed visible and focusable, because the stock form starts with a heading block and the positional fallback matched only the username. With the follow-up, the password was never visible or focusable, including in a second login view opened from the header logo and after going back. See the second table below.style-src 'self'with both engine profiles (0 of 1,215), where the revision before the fix(login): keep the SSO button and password link on the visible login view, and translate the link #366 commits left them in the hidden view. A German bundle held back for 1.5 seconds translated the reveal link, which stayed English before those commits. 10.11.11 gave the same result for the cached views.style-src 'self'Content-Security-Policy across the revisions of this branch. The first table below comes from the revision before the follow-up commits, under that policy, and the second covers the:has()follow-up.enableAutoLoginmatched the checkbox when the browser left the page. I also checked the embedded device flow with the box cleared, with the WebView signal simulated in the browser.inject.jswith one boolean line in front, and it keeps its no-store headers.tests/oidc-bridge.test.mjsuse the stock form order and cover first paint, the strict style policy with and without constructed stylesheets, engines with constructed stylesheets but without:has()(including a remount), a cached second login view with the poll stopped (with and without a style policy that blocks Jellyfin Web's inline.hiderule), the reveal link translation with a bundle that arrives late (the realtfa-i18n.jsandde.json), a second server selected through the URL or the active client while its policy response is held across paint (allowed, restricted, failed and late answers), entering login without a URL change, the per-server reveal, remounts, and older engines withoutURLSearchParams, a workingURLconstructor orArray.prototype.find. Two unit tests check which of the two gate paths an engine takes. A C# theory checks that the script and the public config give the same answer for the same request (six cases, including a LAN client, an exempt range and the plugin turned off).Checklist
dotnet formatif unsure)dotnet build+dotnet testgreen)Screenshots / log slices
Live runs under
style-src 'self'before the follow-up commits, three fresh browser sessions per row:The
:has()follow-up, same policy, Chromium 159 rejecting:has()before any page script ran, password sign-in off, one session per row. The 12.4.0 rows include a second login view opened from the header logo and a return with Back:Without the simulation, this branch still hides the fields through one stylesheet: on 12.4.0 the password was visible in 0 of 1,418 observations across the same navigation.
Additional notes
How it works:
/TwoFactorAuth/injectscript, which Jellyfin Web already loads synchronously in the head, now starts withwindow.__tfaPasswordLoginDisabled = true;orfalse;. The value comes from the same per-request helper that setspasswordLoginDisabledin the public config, and the index HTML keeps its current caching.inject.jssets a root class. When the browser supports:has(), it applies narrowly scoped rules through a constructed stylesheet. Otherwise it hides the elements directly, from a mutation observer that also covers remounts. When the bootstrap value is missing (for example an older cached script), the existing public config gate still applies.enableAutoLogin, as Jellyfin's own submit does, before the browser leaves for an OIDC provider, including the embedded device flow. The passkey path and the one-load hand-off for unchecked users are unchanged.hide) wins over a hidden view that keeps a layout box, which happens under astyle-src 'self'policy because Jellyfin Web's own.hiderule is inline. The reveal link carriesdata-i18n-key, so the translation bundle re-translates it when it loads after the link.LockoutMessageMiddleware, which skips the password check in that case.Limits: the fields are hidden, not removed, so a password manager extension can still find them in the page. przeniek tested Bitwarden on Jellyfin 12.4.0 and reported that its autofill panel no longer appears until the reveal (#362). I did not test a physical WebView, a native app or a real older browser; the older engines above are simulated. If a client restored a cached login view after the route change, with no DOM change and after the first minute, its reveal link and SSO buttons would stay missing until the next page event runs an injection pass; Jellyfin Web 10.11.11 and 12.4 did not show that order in my runs. The server keeps enforcing its own password policy either way. Under the strict style policy, Jellyfin Web's own
tmla-maskelement sat over the login page whether or not the gate was active and caught mouse clicks, so in those runs I activated the reveal with the keyboard.This branch merges cleanly with #361, #363, #347, #349 and #365. The two commits of #366 are included here. When it is combined with #361, the loading document mock in
tests/login-button.test.mjsneedsdocument.createElementand a few related stubs for the new bootstrap. I will add them in whichever of the two is merged second.