"use client"; import { useState } from "react"; import { useRouter } from "next/navigation"; import Link from "next/link"; import { Lock, Key, Eye, EyeOff, ArrowLeft, ShieldCheck } 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 (
{/* Top decorative glow */}

Admin Vault Authentication

Enter your admin password to manage documents and trigger schema mutations.

{error && (
{error}
)}
setPassword(e.target.value)} placeholder="Enter password..." className="w-full pl-10 pr-10 py-3 bg-[var(--bg-elevated)] border border-[var(--border-color)] hover:border-[var(--brand)] rounded-xl text-sm text-[var(--text-primary)] placeholder-[var(--text-dim)] focus:outline-none focus:border-[var(--brand)] focus:ring-2 focus:ring-[var(--brand)]/20 transition-all" required autoFocus />
Return to Knowledge Base Secure HTTP Cookie
); }