Path: blob/master/src/packages/next/pages/auth/sign-in.tsx
6037 views
/*1* This file is part of CoCalc: Copyright © 2021 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45import { Layout } from "antd";6import { useRouter } from "next/router";78import SignIn from "components/auth/sign-in";9import Footer from "components/landing/footer";10import Head from "components/landing/head";11import Header from "components/landing/header";12import basePath from "lib/base-path";13import { Customize } from "lib/customize";14import withCustomize from "lib/with-customize";1516export default function Home({ customize }) {17const { siteName = "CoCalc" } = customize ?? {};18const router = useRouter();19return (20<Customize value={customize}>21<Head title={`Sign in to ${siteName}`} />22<Layout>23<Header page="sign-in" />24<Layout.Content style={{ backgroundColor: "white" }}>25<SignIn onSuccess={() => router.push("/app?sign-in")} />26<Footer />27</Layout.Content>28</Layout>29</Customize>30);31}3233export async function getServerSideProps(context) {34const customize = await withCustomize({ context });35if (customize.props.customize.account != null) {36// user is already signed in -- redirect them to top level page.37const { res } = context;38res.writeHead(302, { location: basePath });39res.end();40return { props: { customize: {} } };41}42return customize;43}444546