132 lines
5.2 KiB
HTML
132 lines
5.2 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>TaskIt! - Project Management</title>
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css" rel="stylesheet">
|
|
<style>
|
|
body {
|
|
background-color: #f4f6f9;
|
|
font-family: 'Inter', sans-serif;
|
|
}
|
|
.auth-container {
|
|
max-width: 400px;
|
|
margin: 5rem auto;
|
|
background-color: white;
|
|
border-radius: 12px;
|
|
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
|
|
padding: 2rem;
|
|
}
|
|
.dashboard-card {
|
|
border-radius: 15px;
|
|
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
|
|
transition: transform 0.3s ease;
|
|
}
|
|
.dashboard-card:hover {
|
|
transform: translateY(-10px);
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="app" class="container-fluid">
|
|
<!-- Login Screen -->
|
|
<div id="loginScreen" class="auth-container text-center">
|
|
<h2 class="mb-4">TaskIt!</h2>
|
|
<form id="loginForm">
|
|
<div class="mb-3">
|
|
<input type="email" class="form-control" placeholder="Email" required>
|
|
</div>
|
|
<div class="mb-3">
|
|
<input type="password" class="form-control" placeholder="Password" required>
|
|
</div>
|
|
<button type="submit" class="btn btn-primary w-100">Login</button>
|
|
<p class="mt-3">Don't have an account? <a href="#" id="showRegister">Register</a></p>
|
|
</form>
|
|
</div>
|
|
|
|
<!-- Registration Screen -->
|
|
<div id="registerScreen" class="auth-container text-center" style="display:none;">
|
|
<h2 class="mb-4">Create Account</h2>
|
|
<form id="registerForm">
|
|
<div class="mb-3">
|
|
<input type="text" class="form-control" placeholder="Full Name" required>
|
|
</div>
|
|
<div class="mb-3">
|
|
<input type="email" class="form-control" placeholder="Email" required>
|
|
</div>
|
|
<div class="mb-3">
|
|
<input type="password" class="form-control" placeholder="Password" required>
|
|
</div>
|
|
<button type="submit" class="btn btn-success w-100">Register</button>
|
|
<p class="mt-3">Already have an account? <a href="#" id="showLogin">Login</a></p>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
|
<script>
|
|
// Simple Auth UI Toggle
|
|
document.getElementById('showRegister').addEventListener('click', function(e) {
|
|
e.preventDefault();
|
|
document.getElementById('loginScreen').style.display = 'none';
|
|
document.getElementById('registerScreen').style.display = 'block';
|
|
});
|
|
|
|
document.getElementById('showLogin').addEventListener('click', function(e) {
|
|
e.preventDefault();
|
|
document.getElementById('registerScreen').style.display = 'none';
|
|
document.getElementById('loginScreen').style.display = 'block';
|
|
});
|
|
|
|
// Authentication Handlers
|
|
document.getElementById('loginForm').addEventListener('submit', async function(e) {
|
|
e.preventDefault();
|
|
const email = this.querySelector('input[type="email"]').value;
|
|
const password = this.querySelector('input[type="password"]').value;
|
|
|
|
try {
|
|
const response = await fetch('/api/login', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ email, password })
|
|
});
|
|
const result = await response.json();
|
|
|
|
if (result.success) {
|
|
window.location.href = '/dashboard.html';
|
|
} else {
|
|
alert(result.error);
|
|
}
|
|
} catch (error) {
|
|
console.error('Login error:', error);
|
|
}
|
|
});
|
|
|
|
document.getElementById('registerForm').addEventListener('submit', async function(e) {
|
|
e.preventDefault();
|
|
const name = this.querySelector('input[type="text"]').value;
|
|
const email = this.querySelector('input[type="email"]').value;
|
|
const password = this.querySelector('input[type="password"]').value;
|
|
|
|
try {
|
|
const response = await fetch('/api/register', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ name, email, password })
|
|
});
|
|
const result = await response.json();
|
|
|
|
if (result.success) {
|
|
window.location.href = '/dashboard.html';
|
|
} else {
|
|
alert(result.error);
|
|
}
|
|
} catch (error) {
|
|
console.error('Registration error:', error);
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |