|
| 1 | +'use client' |
| 2 | + |
| 3 | +import React, { useState } from 'react' |
| 4 | +import { useRouter } from 'next/navigation' |
| 5 | +import { useAdminAuth } from '@/lib/auth' |
| 6 | +import { ShieldCheck, Lock, ArrowRight } from 'lucide-react' |
| 7 | + |
| 8 | +export default function AdminLoginPage() { |
| 9 | + const [password, setPassword] = useState('') |
| 10 | + const [error, setError] = useState('') |
| 11 | + const { login } = useAdminAuth() |
| 12 | + const router = useRouter() |
| 13 | + |
| 14 | + const handleSubmit = (e: React.FormEvent) => { |
| 15 | + e.preventDefault() |
| 16 | + setError('') |
| 17 | + const success = login(password) |
| 18 | + if (success) { |
| 19 | + router.push('/admin') |
| 20 | + } else { |
| 21 | + setError('Invalid admin credentials. Access denied.') |
| 22 | + } |
| 23 | + } |
| 24 | + |
| 25 | + return ( |
| 26 | + <div className="min-h-screen flex flex-col items-center justify-center bg-zinc-950 text-zinc-50 p-4"> |
| 27 | + <div className="w-full max-w-md space-y-6"> |
| 28 | + <div className="text-center space-y-2"> |
| 29 | + <div className="inline-flex p-3 rounded-2xl bg-zinc-900 border border-zinc-800 text-amber-500 mb-2"> |
| 30 | + <ShieldCheck className="h-8 w-8" /> |
| 31 | + </div> |
| 32 | + <h1 className="text-2xl font-mono font-bold tracking-tight text-zinc-50"> |
| 33 | + ADAMU-TECH ADMIN STUDIO |
| 34 | + </h1> |
| 35 | + <p className="text-xs font-sans text-zinc-400"> |
| 36 | + Authorized research publishing portal & content management gate. |
| 37 | + </p> |
| 38 | + </div> |
| 39 | + |
| 40 | + <form onSubmit={handleSubmit} className="p-6 rounded-2xl border border-zinc-800 bg-zinc-900 shadow-2xl space-y-4"> |
| 41 | + {error && ( |
| 42 | + <div className="p-3 rounded-lg bg-red-950/60 border border-red-800 text-red-200 text-xs font-mono"> |
| 43 | + {error} |
| 44 | + </div> |
| 45 | + )} |
| 46 | + |
| 47 | + <div className="space-y-1.5"> |
| 48 | + <label className="text-xs font-mono text-zinc-400 flex items-center gap-1.5"> |
| 49 | + <Lock className="h-3.5 w-3.5 text-zinc-500" /> Admin Secret Password |
| 50 | + </label> |
| 51 | + <input |
| 52 | + type="password" |
| 53 | + required |
| 54 | + value={password} |
| 55 | + onChange={(e) => setPassword(e.target.value)} |
| 56 | + placeholder="Enter password..." |
| 57 | + className="w-full px-4 py-2.5 rounded-lg border border-zinc-800 bg-zinc-950 font-mono text-xs text-zinc-100 focus:outline-none focus:border-zinc-600" |
| 58 | + /> |
| 59 | + </div> |
| 60 | + |
| 61 | + <button |
| 62 | + type="submit" |
| 63 | + className="w-full py-2.5 rounded-lg bg-zinc-100 text-zinc-950 font-mono text-xs font-bold hover:bg-white transition-colors flex items-center justify-center space-x-2" |
| 64 | + > |
| 65 | + <span>Authenticate & Access Studio</span> |
| 66 | + <ArrowRight className="h-4 w-4" /> |
| 67 | + </button> |
| 68 | + |
| 69 | + <p className="text-[10px] font-mono text-center text-zinc-500 pt-2"> |
| 70 | + Protected Session Cookie • Encrypted Verification |
| 71 | + </p> |
| 72 | + </form> |
| 73 | + |
| 74 | + <div className="text-center"> |
| 75 | + <a href="/" className="text-xs font-mono text-zinc-500 hover:text-zinc-300 transition-colors"> |
| 76 | + ← Return to Public Site |
| 77 | + </a> |
| 78 | + </div> |
| 79 | + </div> |
| 80 | + </div> |
| 81 | + ) |
| 82 | +} |
0 commit comments