Sign-in: ask the server sign-in page for the console light or dark look #194
No files matched your search
@@ -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]');
|
||||
});
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user