Spaces:
Running
Running
Download admin-login.html from EHDEM/WASTELESS-V4: direct link, hf CLI and curl.
- Browser
- Download file 4.31 kB
-
https://huggingface.co/spaces/EHDEM/WASTELESS-V4/resolve/main/admin-login.html
- Command line
-
hf download hf://spaces/EHDEM/WASTELESS-V4/admin-login.html
-
curl -L -o admin-login.html https://huggingface.co/spaces/EHDEM/WASTELESS-V4/resolve/main/admin-login.html
4.31 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>WASTE-LESS - Admin Login</title> | |
| <link rel="stylesheet" href="style.css"> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
| </head> | |
| <body class="bg-gray-100 min-h-screen"> | |
| <div class="container mx-auto px-4 py-8 max-w-4xl"> | |
| <!-- Header with back button --> | |
| <header class="bg-blue-600 text-white rounded-lg shadow-lg p-6 mb-8"> | |
| <div class="flex items-center"> | |
| <a href="index.html" class="text-blue-100 hover:text-white mr-4 text-xl"><i class="fas fa-home"></i></a> | |
| <div> | |
| <h1 class="text-3xl font-bold">Admin Login</h1> | |
| <p class="text-blue-100">Access the admin dashboard</p> | |
| </div> | |
| </div> | |
| </header> | |
| <!-- Login Form --> | |
| <div class="bg-white rounded-lg shadow-md p-8 max-w-md mx-auto"> | |
| <form id="login-form"> | |
| <div class="mb-6"> | |
| <label for="username" class="block text-gray-700 font-medium mb-2">Username</label> | |
| <input type="text" id="username" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500" required> | |
| </div> | |
| <div class="mb-6"> | |
| <label for="password" class="block text-gray-700 font-medium mb-2">Password</label> | |
| <input type="password" id="password" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500" required> | |
| </div> | |
| <button type="submit" class="w-full bg-blue-600 hover:bg-blue-700 text-white font-bold py-3 px-4 rounded-lg transition duration-200"> | |
| <i class="fas fa-sign-in-alt mr-2"></i> Login | |
| </button> | |
| </form> | |
| </div> | |
| </div> | |
| <script> | |
| document.getElementById('login-form').addEventListener('submit', function(e) { | |
| e.preventDefault(); | |
| const username = document.getElementById('username').value.trim(); | |
| const password = document.getElementById('password').value; | |
| const submitBtn = document.querySelector('#login-form button'); | |
| const originalBtnText = submitBtn.innerHTML; | |
| // Add loading state | |
| submitBtn.disabled = true; | |
| submitBtn.innerHTML = '<i class="fas fa-spinner fa-spin mr-2"></i> Authenticating...'; | |
| try { | |
| // Verify credentials (hardcoded) | |
| if (username === 'Oppanigas' && password === 'barberkesayangan') { | |
| // Store login state in localStorage | |
| localStorage.setItem('isAdminLoggedIn', 'true'); | |
| localStorage.setItem('lastLogin', new Date().toISOString()); | |
| // Redirect to admin dashboard | |
| window.location.href = 'admin-dashboard.html'; | |
| } else { | |
| throw new Error('Invalid username or password'); | |
| } | |
| } catch (error) { | |
| console.error('Login error:', error); | |
| alert(error.message || 'Login failed. Please try again.'); | |
| } finally { | |
| submitBtn.disabled = false; | |
| submitBtn.innerHTML = originalBtnText; | |
| } | |
| }); | |
| // Check if already logged in and session is still valid | |
| if (localStorage.getItem('isAdminLoggedIn') === 'true') { | |
| const lastLogin = localStorage.getItem('lastLogin'); | |
| const sessionTimeout = 4 * 60 * 60 * 1000; // 4 hours | |
| if (lastLogin && (Date.now() - new Date(lastLogin).getTime()) < sessionTimeout) { | |
| localStorage.setItem('fromLoginPage', 'true'); | |
| window.location.href = 'admin-dashboard.html'; | |
| } else { | |
| // Session expired | |
| localStorage.removeItem('isAdminLoggedIn'); | |
| localStorage.removeItem('lastLogin'); | |
| } | |
| } | |
| </script> | |
| </body> | |
| </html> |