"use client"; import { ArrowRight } from "lucide-react"; import { useRouter } from "next/navigation"; import { useEffect, useState } from "react"; import { Button } from "@/components/ui/button"; import { AuthFormCard, FormError } from "@/components/auth/auth-form-card"; import { BrandLockup } from "@/components/brand"; import { FullScreenLoader } from "@/components/page-layout"; import { ThemeToggle } from "@/components/theme-toggle"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { authClient, signIn, useSession } from "@/lib/auth-client"; export default function LoginPage() { const router = useRouter(); const { data: session, isPending } = useSession(); const [loading, setLoading] = useState(false); const [error, setError] = useState(""); useEffect(() => { if (!isPending && session?.user) { router.replace("/dashboard"); } }, [session, isPending, router]); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setLoading(true); setError(""); const formData = new FormData(e.currentTarget); const email = formData.get("email") as string; const password = formData.get("password") as string; try { const result = await signIn.email({ email, password, }); if (result.error) { setError(result.error.message || "Invalid email or password"); } else { const refreshedSession = await authClient.getSession({ query: { disableCookieCache: true }, }); if (!refreshedSession.data?.user) { setError("Signed in, but the session cookie was not accepted. Check the web and API URLs."); return; } window.location.assign("/dashboard"); } } catch (_err) { setError("Failed to connect to server"); } finally { setLoading(false); } }; if (isPending || session?.user) return ; return (
Minecraft operations platform

Orchestrate
Every World.

Provision servers, manage proxy routes, and monitor Kubernetes workloads from a single operational interface.

Server and cluster administration

); }