fix error page and authentication service
This commit is contained in:
parent
36c363bbda
commit
9f9db78a8f
|
@ -7,12 +7,12 @@ export default async (req, res) => {
|
|||
|
||||
try {
|
||||
const auth = await superagent
|
||||
.get("http://oathkeeper:4455/user")
|
||||
.get("http://oathkeeper:4455/login")
|
||||
.set("cookie", `ory_kratos_session=${req.cookies.ory_kratos_session}`);
|
||||
|
||||
res.setHeader("Set-Cookie", auth.header["set-cookie"]);
|
||||
} catch (error) {
|
||||
res.redirect(302, "/error"); // credentials were correct but accounts service failed
|
||||
res.redirect(302, "/auth/login"); // credentials were correct but accounts service failed
|
||||
}
|
||||
|
||||
res.redirect(302, req.query.return_to ?? "/");
|
||||
|
|
|
@ -11,7 +11,7 @@ export async function getServerSideProps(context) {
|
|||
if (!error || typeof error !== "string") {
|
||||
console.log("No error ID found in URL, redirecting to homepage.");
|
||||
|
||||
return { redirect: { permanent: false, destination: config.kratos.browser } };
|
||||
return { redirect: { permanent: false, destination: "/" } };
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -21,7 +21,7 @@ export async function getServerSideProps(context) {
|
|||
|
||||
throw new Error(`Expected error ${error} to contain "errors" but got ${JSON.stringify(data)}`);
|
||||
} catch (error) {
|
||||
return { redirect: { permanent: false, destination: config.kratos.browser } };
|
||||
return { redirect: { permanent: false, destination: "/" } };
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Reference in New Issue