diff --git a/src/app/auth/error/page.tsx b/src/app/auth/error/page.tsx new file mode 100644 index 0000000..acbce09 --- /dev/null +++ b/src/app/auth/error/page.tsx @@ -0,0 +1,31 @@ +"use client" + +import { Button } from "@/components/ui/button" +import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" +import Link from "next/link" +import { useSearchParams } from "next/navigation" + +export default function AuthErrorPage() { + const searchParams = useSearchParams() + const errorMessage = searchParams.get('error') + + return ( +
+ + + Error + + +
+ {errorMessage} +
+
+ +
+
+
+
+ ) +} diff --git a/src/app/signin/page.tsx b/src/app/auth/signin/page.tsx similarity index 98% rename from src/app/signin/page.tsx rename to src/app/auth/signin/page.tsx index 304f473..a6791a3 100644 --- a/src/app/signin/page.tsx +++ b/src/app/auth/signin/page.tsx @@ -6,7 +6,7 @@ import Link from "next/link" export default async function SignInPage() { const session = await auth() - + // If already signed in, redirect to home if (session?.user) { redirect("/") @@ -32,7 +32,7 @@ export default async function SignInPage() { Continue with Authentik - +
Continue without signing in @@ -42,4 +42,4 @@ export default async function SignInPage() {
) -} \ No newline at end of file +} diff --git a/src/app/signout/page.tsx b/src/app/auth/signout/page.tsx similarity index 100% rename from src/app/signout/page.tsx rename to src/app/auth/signout/page.tsx diff --git a/src/app/components/sign-in.tsx b/src/app/components/sign-in.tsx index 3d6c66f..e7621ca 100644 --- a/src/app/components/sign-in.tsx +++ b/src/app/components/sign-in.tsx @@ -32,9 +32,9 @@ export default function SignIn() { } return ( - )} diff --git a/src/auth.ts b/src/auth.ts index 74b1faa..46ec624 100644 --- a/src/auth.ts +++ b/src/auth.ts @@ -25,9 +25,11 @@ const config = { adapter: DrizzleAdapter(db), providers, pages: { - signIn: "/signin", - signOut: "/signout", + signIn: "/auth/signin", + signOut: "/auth/signout", + error: "/auth/error", }, trustHost: true, } satisfies NextAuthConfig; -export const { handlers, signIn, signOut, auth }: NextAuthResult = NextAuth(config); +export const { handlers, signIn, signOut, auth }: NextAuthResult = + NextAuth(config);