diff --git a/pages/api/auth/[...nextauth].js b/pages/api/auth/[...nextauth].js index def7d7540ad..5493efc64a7 100644 --- a/pages/api/auth/[...nextauth].js +++ b/pages/api/auth/[...nextauth].js @@ -46,6 +46,9 @@ export const authOptions = { return session; }, }, + pages: { + signIn: "/auth/signin", + } }; export default NextAuth(authOptions); diff --git a/pages/auth/signin.js b/pages/auth/signin.js new file mode 100644 index 00000000000..60922fc8131 --- /dev/null +++ b/pages/auth/signin.js @@ -0,0 +1,69 @@ +import BlankLayout from "@components/layouts/BlankLayout" +import { getServerSession } from "next-auth/next" +import { getProviders, signIn } from "next-auth/react" +import Image from "next/image" +import { authOptions } from "pages/api/auth/[...nextauth]" +import { BsGithub } from "react-icons/bs" +import { AiOutlineLock } from "react-icons/ai" + + +export async function getServerSideProps(context) { + const session = await getServerSession(context.req, context.res, authOptions); + + // if the user is logged in redirect, (note: don't redirect to the same page otherwise it'll be in a infinite loop) + if (session) { + return { redirect: { destination: "/account/statistics" } }; + } + + const providers = await getProviders(); + + return { + props: { providers: providers ?? [] }, + } +} + + +export default function SignIn({ providers }) { + + const handleProviderIcon = (provider_name) => { + if (provider_name === "GitHub") { + return + } + return + } + + return ( +
+
+ Your Company +

+ Connect to your audience + with a single link +

+ {Object.values(providers).map((provider) => ( + + ))} +
+
+ ) +} + +SignIn.getLayout = function getLayout(page) { + return ( + + {page} + + ) +} \ No newline at end of file