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