2026-01-28 14:36:33 -07:00
|
|
|
import React, { useState } from 'react';
|
2026-02-10 09:34:22 -07:00
|
|
|
import { AlertCircle, Lock, User } from 'lucide-react';
|
2026-01-28 14:36:33 -07:00
|
|
|
import { useAuth } from '../contexts/AuthContext';
|
|
|
|
|
|
|
|
|
|
export default function LoginForm() {
|
|
|
|
|
const [username, setUsername] = useState('');
|
|
|
|
|
const [password, setPassword] = useState('');
|
|
|
|
|
const [loading, setLoading] = useState(false);
|
|
|
|
|
const [error, setError] = useState('');
|
|
|
|
|
const { login } = useAuth();
|
|
|
|
|
|
|
|
|
|
const handleSubmit = async (e) => {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
setError('');
|
|
|
|
|
setLoading(true);
|
|
|
|
|
|
|
|
|
|
const result = await login(username, password);
|
|
|
|
|
|
|
|
|
|
if (!result.success) {
|
|
|
|
|
setError(result.error);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setLoading(false);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
2026-02-10 09:34:22 -07:00
|
|
|
<div className="min-h-screen bg-intel-darkest grid-bg flex items-center justify-center p-4 relative overflow-hidden fade-in">
|
|
|
|
|
{/* Scanning line effect */}
|
|
|
|
|
<div className="scan-line"></div>
|
|
|
|
|
|
|
|
|
|
<div className="intel-card rounded-lg shadow-2xl max-w-md w-full p-8 border-intel-accent relative z-10">
|
2026-01-28 14:36:33 -07:00
|
|
|
<div className="text-center mb-8">
|
2026-02-10 09:34:22 -07:00
|
|
|
<div className="w-16 h-16 bg-gradient-to-br from-intel-accent to-intel-accent-dim rounded-full flex items-center justify-center mx-auto mb-4 shadow-lg" style={{boxShadow: '0 0 30px rgba(0, 217, 255, 0.4)'}}>
|
|
|
|
|
<Lock className="w-8 h-8 text-intel-darkest" />
|
2026-01-28 14:36:33 -07:00
|
|
|
</div>
|
2026-02-10 09:34:22 -07:00
|
|
|
<h1 className="text-3xl font-bold text-intel-accent font-mono tracking-tight">CVE INTEL</h1>
|
|
|
|
|
<p className="text-gray-400 mt-2 font-sans text-sm">Threat Intelligence Access Portal</p>
|
2026-01-28 14:36:33 -07:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{error && (
|
2026-02-10 09:34:22 -07:00
|
|
|
<div className="mb-6 p-4 bg-intel-danger/10 border border-intel-danger/30 rounded flex items-start gap-3">
|
|
|
|
|
<AlertCircle className="w-5 h-5 text-intel-danger flex-shrink-0 mt-0.5" />
|
|
|
|
|
<p className="text-sm text-gray-300">{error}</p>
|
2026-01-28 14:36:33 -07:00
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
<form onSubmit={handleSubmit} className="space-y-6">
|
|
|
|
|
<div>
|
2026-02-10 09:34:22 -07:00
|
|
|
<label htmlFor="username" className="block text-xs font-medium text-gray-400 mb-2 uppercase tracking-wider">
|
2026-01-28 14:36:33 -07:00
|
|
|
Username
|
|
|
|
|
</label>
|
|
|
|
|
<div className="relative">
|
2026-02-10 09:34:22 -07:00
|
|
|
<User className="w-5 h-5 text-gray-500 absolute left-3 top-1/2 transform -translate-y-1/2" />
|
2026-01-28 14:36:33 -07:00
|
|
|
<input
|
|
|
|
|
id="username"
|
|
|
|
|
type="text"
|
|
|
|
|
required
|
|
|
|
|
value={username}
|
|
|
|
|
onChange={(e) => setUsername(e.target.value)}
|
2026-02-10 09:34:22 -07:00
|
|
|
className="intel-input w-full pl-10"
|
|
|
|
|
placeholder="Enter username"
|
2026-01-28 14:36:33 -07:00
|
|
|
disabled={loading}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div>
|
2026-02-10 09:34:22 -07:00
|
|
|
<label htmlFor="password" className="block text-xs font-medium text-gray-400 mb-2 uppercase tracking-wider">
|
2026-01-28 14:36:33 -07:00
|
|
|
Password
|
|
|
|
|
</label>
|
|
|
|
|
<div className="relative">
|
2026-02-10 09:34:22 -07:00
|
|
|
<Lock className="w-5 h-5 text-gray-500 absolute left-3 top-1/2 transform -translate-y-1/2" />
|
2026-01-28 14:36:33 -07:00
|
|
|
<input
|
|
|
|
|
id="password"
|
|
|
|
|
type="password"
|
|
|
|
|
required
|
|
|
|
|
value={password}
|
|
|
|
|
onChange={(e) => setPassword(e.target.value)}
|
2026-02-10 09:34:22 -07:00
|
|
|
className="intel-input w-full pl-10"
|
|
|
|
|
placeholder="Enter password"
|
2026-01-28 14:36:33 -07:00
|
|
|
disabled={loading}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<button
|
|
|
|
|
type="submit"
|
|
|
|
|
disabled={loading}
|
2026-02-10 09:34:22 -07:00
|
|
|
className="w-full intel-button intel-button-primary py-3 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2"
|
2026-01-28 14:36:33 -07:00
|
|
|
>
|
|
|
|
|
{loading ? (
|
|
|
|
|
<>
|
2026-02-10 09:34:22 -07:00
|
|
|
<div className="loading-spinner w-5 h-5"></div>
|
|
|
|
|
<span className="font-mono uppercase tracking-wider">Authenticating...</span>
|
2026-01-28 14:36:33 -07:00
|
|
|
</>
|
|
|
|
|
) : (
|
2026-02-10 09:34:22 -07:00
|
|
|
<span className="font-mono uppercase tracking-wider">Access System</span>
|
2026-01-28 14:36:33 -07:00
|
|
|
)}
|
|
|
|
|
</button>
|
|
|
|
|
</form>
|
|
|
|
|
|
2026-02-10 09:34:22 -07:00
|
|
|
<div className="mt-6 pt-6 border-t border-intel-grid">
|
|
|
|
|
<p className="text-sm text-gray-500 text-center font-mono">
|
|
|
|
|
Default: <span className="text-intel-accent">admin</span> / <span className="text-intel-accent">admin123</span>
|
2026-01-28 14:36:33 -07:00
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|