215 lines
5.8 KiB
HTML
215 lines
5.8 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Sign In — Nexus One AI</title>
|
|
<link rel="stylesheet" href="style.css?v=4">
|
|
<style>
|
|
body { background: var(--navy); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
|
|
|
|
.login-wrap {
|
|
width: 100%;
|
|
max-width: 420px;
|
|
padding: 20px;
|
|
}
|
|
|
|
.login-brand {
|
|
text-align: center;
|
|
margin-bottom: 36px;
|
|
}
|
|
.login-brand-name {
|
|
font-size: 28px;
|
|
font-weight: 800;
|
|
color: white;
|
|
letter-spacing: .5px;
|
|
}
|
|
.login-brand-name span { color: var(--teal); }
|
|
.login-brand-sub {
|
|
font-size: 13px;
|
|
color: rgba(255,255,255,.45);
|
|
margin-top: 6px;
|
|
}
|
|
|
|
.login-card {
|
|
background:var(--navy2);
|
|
border-radius: 16px;
|
|
padding: 36px 32px;
|
|
box-shadow: 0 24px 60px rgba(0,0,0,.4);
|
|
}
|
|
|
|
.login-title {
|
|
font-size: 20px;
|
|
font-weight: 700;
|
|
color: var(--ink);
|
|
margin-bottom: 6px;
|
|
}
|
|
.login-subtitle {
|
|
font-size: 14px;
|
|
color: var(--lt);
|
|
margin-bottom: 28px;
|
|
}
|
|
|
|
.login-field { margin-bottom: 18px; }
|
|
.login-label {
|
|
display: block;
|
|
font-size: 13px;
|
|
font-weight: 600;
|
|
color: var(--med);
|
|
margin-bottom: 6px;
|
|
}
|
|
.login-input {
|
|
width: 100%;
|
|
padding: 11px 14px;
|
|
border: 1.5px solid var(--bdr);
|
|
border-radius: 8px;
|
|
font-size: 15px;
|
|
color: var(--ink);
|
|
background:var(--navy2);
|
|
transition: border-color .15s, box-shadow .15s;
|
|
outline: none;
|
|
}
|
|
.login-input:focus {
|
|
border-color: var(--teal);
|
|
box-shadow: 0 0 0 3px rgba(13,148,136,.12);
|
|
}
|
|
|
|
.login-btn {
|
|
width: 100%;
|
|
padding: 13px;
|
|
background: var(--teal);
|
|
color: white;
|
|
border: none;
|
|
border-radius: 8px;
|
|
font-size: 15px;
|
|
font-weight: 700;
|
|
cursor: pointer;
|
|
margin-top: 8px;
|
|
transition: background .15s, transform .1s;
|
|
}
|
|
.login-btn:hover { background: #0B7A70; }
|
|
.login-btn:active { transform: scale(.98); }
|
|
.login-btn:disabled { background: var(--xlt); cursor: not-allowed; }
|
|
|
|
.login-error {
|
|
display: none;
|
|
background: #FEF2F2;
|
|
border: 1px solid #FECACA;
|
|
color: #F87171;
|
|
padding: 10px 14px;
|
|
border-radius: 8px;
|
|
font-size: 13px;
|
|
margin-bottom: 16px;
|
|
}
|
|
.login-error.show { display: block; }
|
|
|
|
.login-footer {
|
|
text-align: center;
|
|
margin-top: 28px;
|
|
font-size: 12px;
|
|
color: rgba(255,255,255,.3);
|
|
}
|
|
.login-footer a { color: rgba(255,255,255,.5); }
|
|
|
|
.login-secure {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 6px;
|
|
font-size: 12px;
|
|
color: var(--lt);
|
|
margin-top: 20px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="login-wrap">
|
|
|
|
<div class="login-brand">
|
|
<div class="login-brand-name">Nexus One <span>AI</span></div>
|
|
<div class="login-brand-sub">Management Portal · Basic Tier</div>
|
|
</div>
|
|
|
|
<div class="login-card">
|
|
<div class="login-title">Sign in</div>
|
|
<div class="login-subtitle">Use your Nexus One AI account credentials</div>
|
|
|
|
<div class="login-error" id="login-error"></div>
|
|
|
|
<form id="login-form">
|
|
<div class="login-field">
|
|
<label class="login-label" for="username">Username</label>
|
|
<input class="login-input" type="text" id="username" name="username"
|
|
autocomplete="username" autofocus required placeholder="Enter username">
|
|
</div>
|
|
<div class="login-field">
|
|
<label class="login-label" for="password">Password</label>
|
|
<input class="login-input" type="password" id="password" name="password"
|
|
autocomplete="current-password" required placeholder="Enter password">
|
|
</div>
|
|
<button class="login-btn" type="submit" id="login-btn">Sign in</button>
|
|
</form>
|
|
|
|
<div class="login-secure">
|
|
🔒 Secure · on-premises · air-gapped capable
|
|
</div>
|
|
</div>
|
|
|
|
<div class="login-footer">
|
|
Nexus One AI · Powered by Cezen · <a href="https://cezentech.com" target="_blank">cezentech.com</a>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
// If already logged in, redirect to home
|
|
fetch('/api/auth/me', { credentials: 'include' })
|
|
.then(r => { if (r.ok) window.location.href = '/index.html'; })
|
|
.catch(() => {});
|
|
|
|
const form = document.getElementById('login-form');
|
|
const errEl = document.getElementById('login-error');
|
|
const btn = document.getElementById('login-btn');
|
|
|
|
const params = new URLSearchParams(window.location.search);
|
|
const next = params.get('next') || '/index.html';
|
|
|
|
form.addEventListener('submit', async (e) => {
|
|
e.preventDefault();
|
|
errEl.classList.remove('show');
|
|
btn.disabled = true;
|
|
btn.textContent = 'Signing in…';
|
|
|
|
try {
|
|
const res = await fetch('/api/auth/login', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
credentials: 'include',
|
|
body: JSON.stringify({
|
|
username: document.getElementById('username').value.trim(),
|
|
password: document.getElementById('password').value,
|
|
})
|
|
});
|
|
|
|
if (!res.ok) {
|
|
const data = await res.json().catch(() => ({}));
|
|
throw new Error(data.detail || 'Sign in failed. Check your username and password.');
|
|
}
|
|
|
|
const data = await res.json();
|
|
if (data.must_change_password) {
|
|
window.location.href = '/change-password.html';
|
|
} else {
|
|
window.location.href = next;
|
|
}
|
|
} catch (err) {
|
|
errEl.textContent = err.message;
|
|
errEl.classList.add('show');
|
|
btn.disabled = false;
|
|
btn.textContent = 'Sign in';
|
|
}
|
|
});
|
|
</script>
|
|
<script src="branding.js"></script>
|
|
</body>
|
|
</html>
|