Spaces:
Running
Running
File size: 5,881 Bytes
d2e555d 30b7646 d2e555d 30b7646 d2e555d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login | AuthPortal</title>
<link rel="stylesheet" href="style.css">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<script src="https://unpkg.com/feather-icons"></script>
<script>
tailwind.config = {
theme: {
extend: {
colors: {
primary: '#6366f1',
secondary: '#a855f7',
}
}
}
}
</script>
</head>
<body class="bg-gray-50 min-h-screen">
<custom-header></custom-header>
<main class="container mx-auto px-4 py-12 flex items-center justify-center">
<div class="w-full max-w-md bg-white rounded-xl shadow-md overflow-hidden p-8">
<div class="text-center mb-8">
<h1 class="text-3xl font-bold text-gray-900">Welcome back</h1>
<p class="text-gray-600 mt-2">Log in to your AuthPortal account</p>
</div>
<form id="loginForm" class="space-y-6">
<div>
<label for="email" class="block text-sm font-medium text-gray-700 mb-1">Email</label>
<input type="email" id="email" name="email" required
class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-primary-500 transition-all">
</div>
<div>
<div class="flex justify-between items-center mb-1">
<label for="password" class="block text-sm font-medium text-gray-700">Password</label>
<a href="/forgot-password" class="text-sm text-primary-600 hover:text-primary-500">Forgot password?</a>
</div>
<input type="password" id="password" name="password" required
class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-primary-500 transition-all">
</div>
<div class="flex items-center">
<input id="remember-me" name="remember-me" type="checkbox"
class="h-4 w-4 text-primary-600 focus:ring-primary-500 border-gray-300 rounded">
<label for="remember-me" class="ml-2 block text-sm text-gray-700">Remember me</label>
</div>
<button type="submit"
class="w-full bg-primary-600 hover:bg-primary-700 text-white font-medium py-3 px-4 rounded-lg transition-all flex items-center justify-center">
<span id="loginBtnText">Log In</span>
<div id="loginSpinner" class="ml-2 hidden">
<div class="animate-spin rounded-full h-5 w-5 border-b-2 border-white"></div>
</div>
</button>
</form>
<div class="mt-6 text-center">
<p class="text-gray-600">Don't have an account? <a href="/register" class="text-primary-600 hover:text-primary-500 font-medium">Sign up</a></p>
</div>
<div class="relative mt-8">
<div class="absolute inset-0 flex items-center">
<div class="w-full border-t border-gray-300"></div>
</div>
<div class="relative flex justify-center text-sm">
<span class="px-2 bg-white text-gray-500">Or continue with</span>
</div>
</div>
<div class="mt-6 grid grid-cols-2 gap-3">
<a href="#" class="w-full inline-flex justify-center py-2 px-4 border border-gray-300 rounded-lg bg-white text-sm font-medium text-gray-700 hover:bg-gray-50">
<i data-feather="github" class="h-5 w-5"></i>
</a>
<a href="#" class="w-full inline-flex justify-center py-2 px-4 border border-gray-300 rounded-lg bg-white text-sm font-medium text-gray-700 hover:bg-gray-50">
<i data-feather="google" class="h-5 w-5"></i>
</a>
</div>
</div>
</main>
<custom-footer></custom-footer>
<script src="components/header.js"></script>
<script src="components/footer.js"></script>
<script src="script.js"></script>
<script>
feather.replace();
document.getElementById('loginForm').addEventListener('submit', async function(e) {
e.preventDefault();
const email = document.getElementById('email').value;
const password = document.getElementById('password').value;
// Show loading state
document.getElementById('loginBtnText').textContent = 'Logging in...';
document.getElementById('loginSpinner').classList.remove('hidden');
// Simulate API call
try {
const result = await simulateLogin(email, password);
if (result.success) {
// Redirect to dashboard on success
window.location.href = '/dashboard';
} else {
alert('Invalid email or password');
}
} catch (error) {
alert('Login failed. Please try again.');
} finally {
// Reset button state
document.getElementById('loginBtnText').textContent = 'Log In';
document.getElementById('loginSpinner').classList.add('hidden');
}
});
</script>
</body>
</html> |