Commit
•
101f9ef
1
Parent(s):
1b9697f
🥅 Display OIDC error properly (#261)
Browse files
src/routes/+layout.svelte
CHANGED
@@ -136,7 +136,7 @@
|
|
136 |
{#if isSettingsOpen}
|
137 |
<SettingsModal on:close={() => (isSettingsOpen = false)} settings={data.settings} />
|
138 |
{/if}
|
139 |
-
{#if data.requiresLogin ? !data.user : !data.settings.ethicsModalAcceptedAt}
|
140 |
<LoginModal settings={data.settings} />
|
141 |
{/if}
|
142 |
<slot />
|
|
|
136 |
{#if isSettingsOpen}
|
137 |
<SettingsModal on:close={() => (isSettingsOpen = false)} settings={data.settings} />
|
138 |
{/if}
|
139 |
+
{#if !$page.error && (data.requiresLogin ? !data.user : !data.settings.ethicsModalAcceptedAt)}
|
140 |
<LoginModal settings={data.settings} />
|
141 |
{/if}
|
142 |
<slot />
|
src/routes/login/callback/{+server.ts → +page.server.ts}
RENAMED
@@ -4,16 +4,16 @@ import { z } from "zod";
|
|
4 |
import { base } from "$app/paths";
|
5 |
import { updateUser } from "./updateUser";
|
6 |
|
7 |
-
export async function
|
8 |
-
const { error: errorName } = z
|
9 |
.object({
|
10 |
error: z.string().optional(),
|
|
|
11 |
})
|
12 |
.parse(Object.fromEntries(url.searchParams.entries()));
|
13 |
|
14 |
if (errorName) {
|
15 |
-
|
16 |
-
throw redirect(302, `${base}/`);
|
17 |
}
|
18 |
|
19 |
const { code, state } = z
|
|
|
4 |
import { base } from "$app/paths";
|
5 |
import { updateUser } from "./updateUser";
|
6 |
|
7 |
+
export async function load({ url, locals, cookies }) {
|
8 |
+
const { error: errorName, error_description: errorDescription } = z
|
9 |
.object({
|
10 |
error: z.string().optional(),
|
11 |
+
error_description: z.string().optional(),
|
12 |
})
|
13 |
.parse(Object.fromEntries(url.searchParams.entries()));
|
14 |
|
15 |
if (errorName) {
|
16 |
+
throw error(400, errorName + (errorDescription ? ": " + errorDescription : ""));
|
|
|
17 |
}
|
18 |
|
19 |
const { code, state } = z
|