import React, { useState } from "react"; import { Link, useNavigate } from "react-router-dom"; import { motion } from "framer-motion"; import { BrainCircuit, Mail, Lock, ArrowRight } from "lucide-react"; import { Button } from "../../components/ui/Button"; import { Input } from "../../components/ui/Input"; import { useToast } from "../../components/ui/Toast"; import { supabase } from "../../utils/supabaseClient"; export default function Login() { const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [isLoading, setIsLoading] = useState(false); const navigate = useNavigate(); const { addToast } = useToast(); const handleLogin = async (e) => { e.preventDefault(); setIsLoading(true); try { const { data, error } = await supabase.auth.signInWithPassword({ email, password, }); if (error) throw error; addToast({ title: "Welcome Back!", description: "Successfully logged into ExamCraft.AI", variant: "success", }); navigate("/app"); } catch (error) { addToast({ title: "Login Failed", description: error.message || "Invalid credentials. Please try again.", variant: "destructive", }); } finally { setIsLoading(false); } }; return (
The premium AI toolkit for modern educators. Upload, configure, and generate in seconds.
"ExamCraft.AI cut my paper-setting time from hours to literally minutes. The AI quality is astounding."
Dr. Jane Doe
University Professor
Don't have an account? Create one