Skip to content

Commit c329181

Browse files
committed
chore(auth): guard login callback when ENABLE_LOGIN is false
1 parent ca44060 commit c329181

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/routes/login/callback/+server.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { error, redirect } from "@sveltejs/kit";
2-
import { getOIDCUserData, validateAndParseCsrfToken } from "$lib/server/auth";
2+
import { getOIDCUserData, validateAndParseCsrfToken, loginFeatureEnabled } from "$lib/server/auth";
33
import { z } from "zod";
44
import { base } from "$app/paths";
55
import { config } from "$lib/server/config";
@@ -25,6 +25,9 @@ const allowedUserDomains = z
2525
.parse(JSON5.parse(sanitizeJSONEnv(config.ALLOWED_USER_DOMAINS, "[]")));
2626

2727
export async function GET({ url, locals, cookies, request, getClientAddress }) {
28+
if (!loginFeatureEnabled) {
29+
throw error(404, "Login is disabled");
30+
}
2831
const { error: errorName, error_description: errorDescription } = z
2932
.object({
3033
error: z.string().optional(),

0 commit comments

Comments
 (0)