mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 00:03:33 +10:00
43 lines
945 B
TypeScript
43 lines
945 B
TypeScript
import { NextPageContext } from "next";
|
|
import Head from "next/head";
|
|
import { getUserFromToken } from "@documenso/lib/server";
|
|
import Signup from "../components/signup";
|
|
|
|
export default function SignupPage(props: { source: string }) {
|
|
return (
|
|
<>
|
|
<Head>
|
|
<title>Signup | Documenso</title>
|
|
</Head>
|
|
<Signup source={props.source}></Signup>
|
|
</>
|
|
);
|
|
}
|
|
|
|
export async function getServerSideProps(context: any) {
|
|
if (process.env.ALLOW_SIGNUP !== "true")
|
|
return {
|
|
redirect: {
|
|
destination: "/login",
|
|
permanent: false,
|
|
},
|
|
};
|
|
|
|
const user = await getUserFromToken(context.req, context.res);
|
|
if (user)
|
|
return {
|
|
redirect: {
|
|
source: "/signup",
|
|
destination: "/dashboard",
|
|
permanent: false,
|
|
},
|
|
};
|
|
|
|
const signupSource: string = context.query["source"];
|
|
return {
|
|
props: {
|
|
source: signupSource ? signupSource : "",
|
|
},
|
|
};
|
|
}
|