From 028dfa6ff9bb25f75e2e2d22a9c45062496cd127 Mon Sep 17 00:00:00 2001 From: NextFire Date: Sat, 6 Jan 2024 10:51:05 +0100 Subject: [PATCH] return status:1 if not oidc --- main.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/main.ts b/main.ts index aba3723..9a029e7 100644 --- a/main.ts +++ b/main.ts @@ -6,15 +6,15 @@ const app = new Hono(); app.use("*", logger()); app.post("/prelogin", async (c) => { - const payload = await c.req.json(); - console.debug("req", c.req.url, payload); - if (c.req.query("protocol") === "OIDC") { + const payload = await c.req.json(); + const username = payload.username; const groups = payload.oidc_custom_fields.groups.map((g: string) => ({ name: g.slice(1).replace("discord-", ""), type: 2, })); + const user = { status: 1, username, @@ -24,9 +24,10 @@ app.post("/prelogin", async (c) => { }, }; console.log("oidc", user); + return c.json(user); } else { - return c.json(payload); + return c.json({ status: 1 }); } });