"use client"; import { useState, Suspense } from "react"; import { useRouter, useSearchParams } from "next/navigation"; import { authClient } from "~/lib/auth-client"; import { Card, CardContent } from "~/components/ui/card"; import { Input } from "~/components/ui/input"; import { Button } from "~/components/ui/button"; import { Label } from "~/components/ui/label"; import { toast } from "sonner"; import { Logo } from "~/components/branding/logo"; import { LegalModal } from "~/components/ui/legal-modal"; import { Mail, Lock, ArrowRight, Users, FileText, TrendingUp, Shield, } from "lucide-react"; function SignInForm() { const router = useRouter(); const searchParams = useSearchParams(); const callbackUrl = searchParams.get("callbackUrl") ?? "/dashboard"; const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [loading, setLoading] = useState(false); async function handleSignIn(e: React.FormEvent) { e.preventDefault(); setLoading(true); const { error } = await authClient.signIn.email({ email, password, }); setLoading(false); if (error) { toast.error(error.message ?? "Invalid email or password"); } else { toast.success("Signed in successfully!"); router.push(callbackUrl); router.refresh(); } } async function handleSocialSignIn() { setLoading(true); try { await authClient.signIn.oauth2({ providerId: "authentik", callbackURL: callbackUrl, }); // The signIn.sso method will automatically redirect to the SSO provider } catch (error) { console.error("[SSO Error]", error); setLoading(false); } } return (
Continue managing your clients and creating professional invoices that get you paid faster.
Organize and track all your clients in one place
Beautiful templates that get you paid faster
Monitor your income with real-time insights
Enter your credentials to access your account