From b35ffb3ef82fc2eb294657607e2606f63ce624a9 Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Mon, 15 Feb 2021 00:59:24 +0100 Subject: [PATCH] test --- packages/dashboard/src/pages/api/accounts/authenticate.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/dashboard/src/pages/api/accounts/authenticate.js b/packages/dashboard/src/pages/api/accounts/authenticate.js index 939812f7..9c75c4d1 100644 --- a/packages/dashboard/src/pages/api/accounts/authenticate.js +++ b/packages/dashboard/src/pages/api/accounts/authenticate.js @@ -3,15 +3,15 @@ import superagent from "superagent"; export default async (req, res) => { if (req.cookies.ory_kratos_session) { try { - const auth = await superagent.post("http://oathkeeper:4455/login"); - // .set("cookie", `ory_kratos_session=${req.cookies.ory_kratos_session}`); + const auth = await superagent + .post("http://oathkeeper:4455/login") + .set("cookie", `ory_kratos_session=${req.cookies.ory_kratos_session}`); res.setHeader("Set-Cookie", auth.header["set-cookie"]); + res.redirect(302, req.query.return_to ?? "/"); } catch (error) { res.redirect(302, "/auth/login"); // credentials were correct but accounts service failed } - - res.redirect(302, req.query.return_to ?? "/"); } else { res.redirect(302, "/auth/login"); // redirect to login page if kratos session is missing }