From 6bf77b05aa54d0a24c7253c34c3d4bcea5685291 Mon Sep 17 00:00:00 2001 From: Sean Norwood Date: Wed, 13 Apr 2022 18:08:19 +0000 Subject: [PATCH] chore: add login page --- .../www/src/pages/api/auth/[...nextauth].ts | 3 + tubearchivist/www/src/pages/auth/login.tsx | 79 +++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 tubearchivist/www/src/pages/auth/login.tsx diff --git a/tubearchivist/www/src/pages/api/auth/[...nextauth].ts b/tubearchivist/www/src/pages/api/auth/[...nextauth].ts index 59a379a..5a63b4d 100644 --- a/tubearchivist/www/src/pages/api/auth/[...nextauth].ts +++ b/tubearchivist/www/src/pages/api/auth/[...nextauth].ts @@ -59,6 +59,9 @@ export default NextAuth({ }), // ...add more providers here ], + pages: { + signIn: "/auth/login", + }, session: { maxAge: 30 * 24 * 60 * 60, strategy: "jwt", diff --git a/tubearchivist/www/src/pages/auth/login.tsx b/tubearchivist/www/src/pages/auth/login.tsx new file mode 100644 index 0000000..dfbc7d2 --- /dev/null +++ b/tubearchivist/www/src/pages/auth/login.tsx @@ -0,0 +1,79 @@ +import { CustomHead } from "../../components/CustomHead"; +import { Layout } from "../../components/Layout"; +import NextImage from "next/image"; +import Logo from "../../images/logo-tube-archivist-dark.png"; +import { getCsrfToken } from "next-auth/react"; +import { NextPageContext } from "next"; +import { useRouter } from "next/router"; + +export async function getServerSideProps(context: NextPageContext) { + return { + props: { + csrfToken: await getCsrfToken(context), + }, + }; +} + +const Login = ({ csrfToken }) => { + const { query } = useRouter(); + return ( + <> + + +
+ {/* {% if colors == 'dark' %} */} + + {/* {% endif %} */} + {/* {% if colors == 'light' %} */} + {/* tube-archivist-banner */} + {/* {% endif %} */} +

Tube Archivist

+

Your Self Hosted YouTube Media Server

+ {query.error &&

Failed to login.

} +
+ + + {/*

Remember me: form.remember_me

*/} + + +
+

+ + + Github + + {" "} + + + Donate + + +

+
+
+
+
+
+
+ + ); +}; + +export default Login;