"use client"; import React, { useState, useEffect } from "react"; import { useRouter } from "next/navigation"; import { Lock, Mail, ArrowRight, Eye, EyeOff, ShieldAlert, ExternalLink } from "lucide-react"; import { fetchApi, setTokens, setUserProfile, getAccessToken } from "@/app/utils/api"; export default function LoginPage() { const router = useRouter(); const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [showPass, setShowPass] = useState(false); const [loading, setLoading] = useState(false); const [error, setError] = useState(null); useEffect(() => { if (getAccessToken()) router.push("/dashboard"); }, [router]); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setLoading(true); setError(null); try { const params = new URLSearchParams(); params.append("username", email); params.append("password", password); const response = await fetchApi("/auth/login", { method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded" }, body: params, }); setTokens(response.access_token, response.refresh_token); const profile = await fetchApi("/auth/me"); setUserProfile(profile); router.push("/dashboard"); } catch (err: any) { setError(err.message || "Invalid credentials. Please try again."); } finally { setLoading(false); } }; return (
{/* Grid Mesh background */}
{/* Ambient background glows */}
{/* Logo block */}
{/* Ambient glowing background inside the container */}
{/* Robotic eye SVG */} {/* Outer technical rotating rings */} {/* Outer eye contour (fixed robot frame) */} {/* Blinking Eyelid Overlay/Aperture */} {/* Sclera/Iris */} {/* Glowing Iris Details */} {/* Glowing Pupil */} {/* Pupil reflection */} {/* Futuristic crosshairs / HUD markers */} {/* Scanning laser beam overlay */} {/* Def for glow filter */}

NetraID

AI Biometric Attendance Platform

{/* Login card */}

Sign in to dashboard

Use your administrator credentials to continue

{/* Error state */} {error && (
{error}
)}
{/* Email */}
setEmail(e.target.value)} className="input-field pl-icon h-11 bg-white border-slate-200 text-slate-900 rounded-xl focus:border-slate-800" autoComplete="email" suppressHydrationWarning />
{/* Password */}
setPassword(e.target.value)} className="input-field pl-icon pr-icon h-11 bg-white border-slate-200 text-slate-900 rounded-xl focus:border-slate-800" autoComplete="current-password" suppressHydrationWarning />
{/* Submit */}
{/* Default credentials hint */}

Default: admin@netraid.ai / Admin@NetraID2026

{/* Kiosk link */} {/* Footer */}

NetraID v1.0.0 · Open Source · MIT License

); }