"use client"; import { signIn } from "next-auth/react"; import Link from "next/link"; import { useRouter } from "next/navigation"; import { useState } from "react"; import { Button } from "~/components/ui/button"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "~/components/ui/card"; import { Input } from "~/components/ui/input"; import { Label } from "~/components/ui/label"; import { Logo } from "~/components/ui/logo"; export default function SignInPage() { const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [isLoading, setIsLoading] = useState(false); const [error, setError] = useState(""); const router = useRouter(); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setIsLoading(true); setError(""); try { const result = await signIn("credentials", { email, password, redirect: false, }); if (result?.error) { setError("Invalid email or password"); } else { router.push("/"); router.refresh(); } } catch (error: unknown) { setError( error instanceof Error ? error.message : "An error occurred. Please try again.", ); } finally { setIsLoading(false); } }; return (
Sign in to your research account
© {new Date().getFullYear()} HRIStudio. All rights reserved.