From fa923174d90d86beabe49dc8a63df579bbd9d573 Mon Sep 17 00:00:00 2001 From: John Coffey Date: Wed, 11 Nov 2026 11:37:17 -0700 Subject: [PATCH] Sign-in: ask the server's sign-in page for the console's light or dark look The authorize request carries theme=light or theme=dark, whichever the console is showing, so the sign-in page no longer flips to the OS setting in between (inbuxa-server #375, page support in server PR #376). Servers without that support ignore the parameter. --- src/services/auth/oauth.test.ts | 10 ++++++++++ src/services/auth/oauth.ts | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/services/auth/oauth.test.ts b/src/services/auth/oauth.test.ts index 9bba7db..2efd74e 100644 --- a/src/services/auth/oauth.test.ts +++ b/src/services/auth/oauth.test.ts @@ -167,6 +167,7 @@ describe('startAuthFlow', () => { code_challenge_method: 'S256', state: stored.state, prompt: 'login', + theme: 'light', scope: 'openid profile offline_access', }); expect(stored.state).toMatch(/^[0-9a-f]{32}$/); @@ -177,6 +178,15 @@ describe('startAuthFlow', () => { }); }); + it("asks the sign-in page for the console's dark look when it shows one", async () => { + document.documentElement.classList.add('dark'); + try { + expect((await signIn(null)).searchParams.get('theme')).toBe('dark'); + } finally { + document.documentElement.classList.remove('dark'); + } + }); + it('prefills the account when given one', async () => { expect((await signIn('ann@example.org')).searchParams.get('login_hint')).toBe('ann@example.org'); }); diff --git a/src/services/auth/oauth.ts b/src/services/auth/oauth.ts index 7bbaa20..b94bbc8 100644 --- a/src/services/auth/oauth.ts +++ b/src/services/auth/oauth.ts @@ -192,6 +192,8 @@ export async function startAuthFlow(username: string | null, returnUrl?: string state, // Always ask for the password: a console session should never start silently. prompt: 'login', + // The sign-in page shows the console's own light or dark look (inbuxa-server #375). + theme: document.documentElement.classList.contains('dark') ? 'dark' : 'light', }); if (username) query.set('login_hint', username); const scope = scopesFor(endpoints.scopes_supported); -- 2.54.0