"use client"; import { useState, type FormEvent } from "react"; import { signIn } from "next-auth/react"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; // Custom Credentials sign-in page for Auth.js v5 (src/auth.ts's // pages.signIn points here). Internal IT-staff login only — no // self-registration, so there's no "sign up" link. Deliberately shows a // generic error on failure (doesn't say whether the email or the password // was wrong) to avoid leaking which accounts exist. export default function LoginPage() { const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [error, setError] = useState(null); const [submitting, setSubmitting] = useState(false); async function handleSubmit(event: FormEvent): Promise { event.preventDefault(); setError(null); setSubmitting(true); try { const result = await signIn("credentials", { email, password, redirect: false, }); if (!result || result.error) { setError("Invalid email or password"); return; } window.location.href = "/"; } finally { setSubmitting(false); } } return (

Sign in

IT staff login

setEmail(event.target.value)} />
setPassword(event.target.value)} />
{error ? (

{error}

) : null}
); }