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

35 lines
735 B
TypeScript
Raw Normal View History

2023-01-04 16:28:32 +01:00
import Head from "next/head";
import { getUserFromToken } from "@documenso/lib/server";
2022-12-06 19:16:34 +01:00
import Login from "../components/login";
2023-03-19 14:59:10 +01:00
export default function LoginPage(props: any) {
2022-12-06 19:16:34 +01:00
return (
<>
2023-01-04 16:28:32 +01:00
<Head>
<title>Login | Documenso</title>
</Head>
2023-03-19 14:59:10 +01:00
<Login allowSignup={props.ALLOW_SIGNUP}></Login>
2022-12-06 19:16:34 +01:00
</>
);
}
2023-03-19 14:59:10 +01:00
export async function getServerSideProps(context: any) {
const user = await getUserFromToken(context.req, context.res);
if (user)
return {
redirect: {
source: "/login",
destination: "/dashboard",
permanent: false,
},
};
2023-05-06 16:11:56 +10:00
const ALLOW_SIGNUP = process.env.NEXT_PUBLIC_ALLOW_SIGNUP === "true";
2023-03-19 14:59:10 +01:00
return {
props: {
2023-05-06 16:11:56 +10:00
ALLOW_SIGNUP,
2023-03-19 14:59:10 +01:00
},
};
}