Features: - Manager-centric parking spot management - Fair assignment algorithm (parking/presence ratio) - Presence tracking calendar - Closing days (specific & weekly recurring) - Guarantees and exclusions - Authelia/LLDAP integration for SSO Stack: - FastAPI backend - SQLite database - Vanilla JS frontend - Docker deployment
99 lines
3.6 KiB
HTML
99 lines
3.6 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Register - Parking Manager</title>
|
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
|
|
<link rel="stylesheet" href="/css/styles.css">
|
|
</head>
|
|
<body>
|
|
<div class="auth-container">
|
|
<div class="auth-card">
|
|
<div class="auth-header">
|
|
<h1>Create Account</h1>
|
|
<p>Sign up for a new account</p>
|
|
</div>
|
|
|
|
<div id="errorMessage"></div>
|
|
|
|
<form id="registerForm">
|
|
<div class="form-group">
|
|
<label for="name">Full Name</label>
|
|
<input type="text" id="name" required autocomplete="name">
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="email">Email</label>
|
|
<input type="email" id="email" required autocomplete="email">
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="password">Password</label>
|
|
<input type="password" id="password" required autocomplete="new-password" minlength="8">
|
|
<small>Minimum 8 characters</small>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="office">Office (optional)</label>
|
|
<select id="office">
|
|
<option value="">Select an office...</option>
|
|
</select>
|
|
</div>
|
|
<button type="submit" class="btn btn-dark btn-full">Create Account</button>
|
|
</form>
|
|
|
|
<div class="auth-footer">
|
|
Already have an account? <a href="/login">Sign in</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="/js/api.js"></script>
|
|
<script>
|
|
// Redirect if already logged in
|
|
if (api.isAuthenticated()) {
|
|
window.location.href = '/presence';
|
|
}
|
|
|
|
// Load offices
|
|
async function loadOffices() {
|
|
try {
|
|
const response = await fetch('/api/offices');
|
|
if (response.ok) {
|
|
const offices = await response.json();
|
|
const select = document.getElementById('office');
|
|
offices.forEach(office => {
|
|
const option = document.createElement('option');
|
|
option.value = office.id;
|
|
option.textContent = office.name;
|
|
select.appendChild(option);
|
|
});
|
|
}
|
|
} catch (error) {
|
|
console.error('Failed to load offices:', error);
|
|
}
|
|
}
|
|
|
|
loadOffices();
|
|
|
|
document.getElementById('registerForm').addEventListener('submit', async (e) => {
|
|
e.preventDefault();
|
|
|
|
const name = document.getElementById('name').value;
|
|
const email = document.getElementById('email').value;
|
|
const password = document.getElementById('password').value;
|
|
const officeId = document.getElementById('office').value || null;
|
|
const errorDiv = document.getElementById('errorMessage');
|
|
|
|
errorDiv.innerHTML = '';
|
|
|
|
const result = await api.register(email, password, name, officeId);
|
|
|
|
if (result.success) {
|
|
window.location.href = '/presence';
|
|
} else {
|
|
errorDiv.innerHTML = `<div class="message error">${result.error}</div>`;
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|