Sign-in: ask the server sign-in page for the console light or dark look #194

Merged
jcoffey-dev merged 1 commits from feat/sign-in-theme into main 2026-11-11 18:51:07 +00:00
2 changed files with 12 additions and 0 deletions

No files matched your search

+10
View File
@@ -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('[email protected]')).searchParams.get('login_hint')).toBe('[email protected]');
});
+2
View File
@@ -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);