From 9221042db421823423c79751161e2870d8611c3d Mon Sep 17 00:00:00 2001 From: Agusti Fernandez Pardo <6601142+agustif@users.noreply.github.com> Date: Tue, 9 Aug 2022 23:38:21 +0200 Subject: [PATCH] feat: signin test email magic signup in app (#3749) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: signin test email magic signup in app * fix: no signIn page in nextauth * fix: remove commented signIN * Update apps/web/pages/auth/signin.tsx remove import useRouter Co-authored-by: Omar López Co-authored-by: Agusti Fernandez Pardo Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> Co-authored-by: Omar López --- apps/web/pages/auth/signin.tsx | 42 ++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 apps/web/pages/auth/signin.tsx diff --git a/apps/web/pages/auth/signin.tsx b/apps/web/pages/auth/signin.tsx new file mode 100644 index 0000000000..279e6d1518 --- /dev/null +++ b/apps/web/pages/auth/signin.tsx @@ -0,0 +1,42 @@ +import { GetServerSidePropsContext } from "next"; +import { getProviders, signIn, getSession, getCsrfToken } from "next-auth/react"; + +import { Button } from "@calcom/ui/v2"; + +type Provider = { + name: string; + id: string; +}; + +function signin({ providers }: { providers: Provider[] }) { + return ( +
+ {Object.values(providers).map((provider) => { + return ( +
+ +
+ ); + })} +
+ ); +} + +export default signin; + +export async function getServerSideProps(context: GetServerSidePropsContext) { + const session = await getSession(context); + const csrfToken = await getCsrfToken(context); + const providers = await getProviders(); + if (session) { + return { + redirect: { destination: "/" }, + }; + } + return { + props: { + csrfToken, + providers, + }, + }; +}