"use client" import { useState, useEffect, useRef } from "react" import { useRouter } from "next/navigation" import { motion } from "framer-motion" import { Button } from "@/components/ui/button" import { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" import { Checkbox } from "@/components/ui/checkbox" import { COMPANY_NAME } from "@/lib/constants" import { Eye, EyeOff, Loader2 } from "lucide-react" function LoginForm() { const router = useRouter() const [email, setEmail] = useState("") const [password, setPassword] = useState("") const [showPassword, setShowPassword] = useState(false) const [loading, setLoading] = useState(false) const [remember, setRemember] = useState(false) const handleSubmit = async (e: React.FormEvent) => { e.preventDefault() setLoading(true) try { const res = await fetch("/api/auth/login", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ email, password }), }) if (res.ok) { router.push("/dashboard") } else { const data = await res.json().catch(() => ({})) setError(data.error || "Invalid email or password.") } } catch { setError("Connection error. Please try again.") } finally { setLoading(false) } } return (
Manage leads, track conversions, and grow your web development business with our CRM.
“{testimonials[testimonialIndex].text}”
{testimonials[testimonialIndex].author}
Sign in to your account to continue
{error && (By signing in, you agree to our{" "} {" "} and{" "}