Files
sign/apps/web/pages/signup.tsx

43 lines
957 B
TypeScript
Raw Normal View History

import { NextPageContext } from "next";
2023-01-11 14:36:59 +01:00
import Head from "next/head";
import { getUserFromToken } from "@documenso/lib/server";
2023-01-11 14:36:59 +01:00
import Signup from "../components/signup";
export default function SignupPage(props: { source: string }) {
2023-01-11 14:36:59 +01:00
return (
<>
<Head>
2023-01-11 15:22:09 +01:00
<title>Signup | Documenso</title>
2023-01-11 14:36:59 +01:00
</Head>
<Signup source={props.source}></Signup>
2023-01-11 14:36:59 +01:00
</>
);
2022-12-06 19:28:19 +01:00
}
export async function getServerSideProps(context: any) {
2023-05-21 20:10:06 +02:00
if (process.env.NEXT_PUBLIC_ALLOW_SIGNUP !== "true")
2023-03-19 14:59:10 +01:00
return {
redirect: {
destination: "/login",
permanent: false,
},
};
const user = await getUserFromToken(context.req, context.res);
if (user)
return {
redirect: {
source: "/signup",
destination: "/dashboard",
permanent: false,
},
};
2023-03-19 15:06:01 +01:00
const signupSource: string = context.query["source"];
return {
props: {
source: signupSource ? signupSource : "",
},
};
}