feat(auth): restrict admin access to verified Google email
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { redirect } from "next/navigation";
|
||||
import { connection } from "next/server";
|
||||
|
||||
import { LoginCard } from "@/components/admin/login-card";
|
||||
import { SiteHeader } from "@/components/public/site-header";
|
||||
import { getAdminSession } from "@/lib/auth/server";
|
||||
|
||||
export default async function AdminLoginPage() {
|
||||
await connection();
|
||||
if (await getAdminSession()) redirect("/admin");
|
||||
|
||||
return (
|
||||
<div className="min-h-svh">
|
||||
<SiteHeader />
|
||||
<main className="grid min-h-[calc(100svh-4rem)] place-items-center px-4 py-12">
|
||||
<LoginCard />
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import { toNextJsHandler } from "better-auth/next-js";
|
||||
|
||||
import { getAuth } from "@/lib/auth/server";
|
||||
|
||||
const handlers = toNextJsHandler((request) => getAuth().handler(request));
|
||||
|
||||
export const GET = handlers.GET;
|
||||
export const POST = handlers.POST;
|
||||
export const PATCH = handlers.PATCH;
|
||||
export const PUT = handlers.PUT;
|
||||
export const DELETE = handlers.DELETE;
|
||||
Reference in New Issue
Block a user