Files
boc/web/index.html
T

86 lines
3.4 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html lang="sv">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>BOC — Business Operations Center</title>
<link rel="stylesheet" href="assets/boc.css">
</head>
<body>
<div class="login-container">
<div class="login-box">
<div class="login-logo">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="2" y="7" width="20" height="14" rx="2" ry="2"/>
<path d="M16 21V5a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16"/>
</svg>
</div>
<h1>Business Operations Center</h1>
<p class="subtitle">Logga in for att hantera ditt foretag</p>
<div class="error-msg" id="error"></div>
<form id="loginForm">
<div class="form-group">
<label for="email">E-post</label>
<input type="email" id="email" placeholder="namn@foretag.se" required
value="erik@landvex.com">
</div>
<div class="form-group">
<label for="password">Losenord</label>
<input type="password" id="password" placeholder="••••••••" required
value="Erik1987">
</div>
<button type="submit" class="btn-primary" id="submitBtn">Logga in</button>
</form>
<div class="login-footer">
Landvex Inc · AAMOS Platform<br>
<a href="https://aamos.systems">aamos.systems</a>
</div>
</div>
</div>
<script>
document.getElementById('loginForm').addEventListener('submit', async (e) => {
e.preventDefault();
const error = document.getElementById('error');
const btn = document.getElementById('submitBtn');
error.classList.remove('show');
const email = document.getElementById('email').value;
const password = document.getElementById('password').value;
btn.disabled = true;
btn.textContent = 'Loggar in...';
try {
const res = await fetch('/api/v1/auth/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ email, password })
});
const data = await res.json();
if (data.token) {
localStorage.setItem('boc_token', data.token);
localStorage.setItem('boc_user', JSON.stringify(data.user));
window.location.href = '/dashboard.html';
} else {
error.textContent = data.error || 'Inloggning misslyckades';
error.classList.add('show');
}
} catch (err) {
error.textContent = 'Anslutningsfel. Forsok igen.';
error.classList.add('show');
} finally {
btn.disabled = false;
btn.textContent = 'Logga in';
}
});
</script>
</body>
</html>