feat(auth): restrict admin access to verified Google email

This commit is contained in:
2026-08-28 19:26:57 +00:00 Unverified
parent 0d23871499
commit fdbc6e7d9f
7 changed files with 233 additions and 0 deletions
+20
View File
@@ -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>
);
}
+11
View File
@@ -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;