feat: signin test email magic signup in app (#3749)

* 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 <zomars@me.com>

Co-authored-by: Agusti Fernandez Pardo <git@agusti.me>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Omar López <zomars@me.com>
pull/3661/head
Agusti Fernandez Pardo 2022-08-09 23:38:21 +02:00 committed by GitHub
parent b936b7c256
commit 9221042db4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 42 additions and 0 deletions

View File

@ -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 (
<div className="center mt-10 justify-between space-y-5 text-center align-baseline">
{Object.values(providers).map((provider) => {
return (
<div key={provider.name}>
<Button onClick={() => signIn(provider.id)}>Sign in with {provider.name}</Button>
</div>
);
})}
</div>
);
}
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,
},
};
}