import React, { useState } from 'react'; import axios from 'axios'; import { motion } from 'framer-motion'; import { FaLock, FaSpinner } from 'react-icons/fa'; const LoginScreen = ({ onAuthenticated }) => { const [password, setPassword] = useState(''); const [loading, setLoading] = useState(false); const [error, setError] = useState(null); const handleSubmit = async (e) => { e.preventDefault(); if (!password.trim()) { setError('Please enter a password'); return; } setLoading(true); setError(null); try { const response = await axios.post('/api/auth/verify', { password }); if (response.data.authenticated) { // Store auth state in sessionStorage (cleared when browser closes) sessionStorage.setItem('auth_verified', 'true'); onAuthenticated(); } } catch (err) { if (err.response?.status === 401) { setError('Invalid password. Please try again.'); } else { setError('Authentication failed. Please try again.'); } console.error('Auth error:', err); } finally { setLoading(false); } }; return (

Certificate Manager

Enter password to access

setPassword(e.target.value)} className="w-full border border-gray-300 rounded-lg p-3 text-gray-900 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none" placeholder="Enter access password" autoFocus />
{error && ( {error} )} {loading ? ( <> Verifying... ) : ( <> Access Application )}

Protected application. Contact administrator for access.

); }; export default LoginScreen;