From 64db6a0c381bf7f3a60e2dedbfd1268d667a099d Mon Sep 17 00:00:00 2001 From: Jonas Hungershausen Date: Thu, 14 Sep 2023 15:45:04 +0200 Subject: [PATCH] feat: add org login switcher --- src/routes/login.ts | 3 +- views/login.hbs | 1 + views/partials/organizations.hbs | 49 ++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 views/partials/organizations.hbs diff --git a/src/routes/login.ts b/src/routes/login.ts index c97dc432..e03ac1b6 100644 --- a/src/routes/login.ts +++ b/src/routes/login.ts @@ -82,7 +82,7 @@ export const createLoginRoute: RouteCreator = }) .then(({ headers, data: verificationFlow }) => { // we need the csrf cookie from the verification flow - res.setHeader("set-cookie", headers["set-cookie"]) + res.setHeader("set-cookie", headers["set-cookie"] || "") // encode the verification flow id in the query parameters const verificationParameters = new URLSearchParams({ flow: verificationFlow.id, @@ -168,6 +168,7 @@ export const createLoginRoute: RouteCreator = res.render("login", { nodes: flow.ui.nodes, + organizations: JSON.stringify(res.locals.organizations), webAuthnHandler: filterNodesByGroups({ nodes: flow.ui.nodes, groups: ["webauthn"], diff --git a/views/login.hbs b/views/login.hbs index c2d013a6..bd662657 100644 --- a/views/login.hbs +++ b/views/login.hbs @@ -2,4 +2,5 @@ {{{card}}} {{> webauthn_setup nodes=nodes webAuthnHandler=webAuthnHandler webauthnTriggerName="webauthn_login_trigger"}} + {{> organizations}} diff --git a/views/partials/organizations.hbs b/views/partials/organizations.hbs new file mode 100644 index 00000000..5aaecc2d --- /dev/null +++ b/views/partials/organizations.hbs @@ -0,0 +1,49 @@ + \ No newline at end of file