registration

This commit is contained in:
Karol Wypchlo 2021-02-16 13:04:18 +01:00
parent 7eb580558e
commit a343a7cf54
1 changed files with 3 additions and 2 deletions

View File

@ -8,6 +8,7 @@ const kratos = new PublicApi(new Configuration({ basePath: config.kratos.public
export async function getServerSideProps(context) { export async function getServerSideProps(context) {
const flow = context.query.flow; const flow = context.query.flow;
const redirect = encodeURIComponent(`/api/accounts/login?return_to=${context.query.return_to ?? "/"}`);
if (process.env.NODE_ENV === "development") { if (process.env.NODE_ENV === "development") {
return { props: { flow: require("../../../stubs/registration.json") } }; return { props: { flow: require("../../../stubs/registration.json") } };
@ -21,7 +22,7 @@ export async function getServerSideProps(context) {
return { return {
redirect: { redirect: {
permanent: false, permanent: false,
destination: `${config.kratos.browser}/self-service/registration/browser`, destination: `${config.kratos.browser}/self-service/registration/browser?return_to=${redirect}`,
}, },
}; };
} }
@ -36,7 +37,7 @@ export async function getServerSideProps(context) {
return { return {
redirect: { redirect: {
permanent: false, permanent: false,
destination: `${config.kratos.browser}/self-service/registration/browser`, destination: `${config.kratos.browser}/self-service/registration/browser?return_to=${redirect}`,
}, },
}; };
} }