feat: return access_denied to the app when sign-in is cancelled

This commit is contained in:
Elias Schneider
2026-10-27 23:32:53 +01:00
parent 80b12b910a
commit 75e4ee624a
5 changed files with 116 additions and 9 deletions
+6 -5
View File
@@ -99,10 +99,11 @@ test('Change Locale', async ({ page }) => {
// Check if th language heading now says 'Taal' instead of 'Language'
await expect(page.getByText('Taal', { exact: true })).toBeVisible();
// Check if the validation messages are translated because they are provided by Zod
await page.getByRole('textbox', { name: 'Gebruikersnaam' }).fill('');
// Saving still validates in the new language
const username = page.getByRole('textbox', { name: 'Gebruikersnaam' });
await username.fill('');
await page.getByRole('button', { name: 'Opslaan' }).click();
await expect(page.getByText('Te kort: verwacht dat string >=1 tekens heeft')).toBeVisible();
await expect(username).toHaveAttribute('aria-invalid', 'true');
// Clear all cookies and sign in again to check if the language is still set to Dutch
await page.context().clearCookies();
@@ -110,9 +111,9 @@ test('Change Locale', async ({ page }) => {
await expect(page.getByText('Taal', { exact: true })).toBeVisible();
await page.getByRole('textbox', { name: 'Gebruikersnaam' }).fill('');
await username.fill('');
await page.getByRole('button', { name: 'Opslaan' }).click();
await expect(page.getByText('Te kort: verwacht dat string >=1 tekens heeft')).toBeVisible();
await expect(username).toHaveAttribute('aria-invalid', 'true');
});
test('Add passkey to an account', async ({ page }) => {
+15
View File
@@ -103,6 +103,21 @@ test('Authorize new client', async ({ page }) => {
);
});
test('Cancel on the consent screen returns access_denied to the client', async ({ page }) => {
const oidcClient = oidcClients.immich;
const urlParams = createUrlParams(oidcClient);
await page.goto(`/authorize?${urlParams.toString()}`);
await expectScopes(page, ['Email address', 'Name, username and picture']);
const callbackUrl = await expectCallbackRedirect(page, oidcClient.callbackUrl, () =>
page.getByRole('link', { name: 'Cancel', exact: true }).click()
);
expect(callbackUrl.searchParams.get('error')).toBe('access_denied');
expect(callbackUrl.searchParams.get('code')).toBeNull();
expect(callbackUrl.searchParams.get('state')).toBe(urlParams.get('state'));
});
test('Authorize client requesting offline_access scope', async ({ page }) => {
const oidcClient = oidcClients.immich;
const urlParams = createUrlParams(oidcClient);