"use client"; import { useState } from "react"; import { useRouter } from "next/navigation"; import Link from "next/link"; import { Lock, Key, Eye, EyeOff, ArrowLeft } from "lucide-react"; export default function LoginPage() { const router = useRouter(); const [password, setPassword] = useState(""); const [showPassword, setShowPassword] = useState(false); const [loading, setLoading] = useState(false); const [error, setError] = useState(null); async function handleSubmit(e: React.FormEvent) { e.preventDefault(); setLoading(true); setError(null); try { const res = await fetch("/api/auth/login", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ password }), }); if (!res.ok) { const data = await res.json().catch(() => ({})); throw new Error(data.error ?? "Invalid password. Check ADMIN_PASSWORD."); } router.push("/create"); } catch (err) { setError(err instanceof Error ? err.message : String(err)); } finally { setLoading(false); } } return (

Admin Authentication

Enter administrative password to authorize document mutations.

{error && (
{error}
)}
setPassword(e.target.value)} placeholder="Enter admin password..." className="w-full pl-9 pr-10 py-2.5 bg-[var(--bg-elevated)] border border-[var(--border-color)] hover:border-[var(--text-muted)] rounded-lg text-sm text-[var(--text-primary)] placeholder-[var(--text-dim)] focus:outline-none focus:border-[var(--text-primary)] transition-colors font-mono" required autoFocus />
Return to Home HTTP Cookie
); }