aipackage/cezen-portal/login.html
2026-06-30 16:29:03 +05:30

225 lines
6.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>Sign In — Nexus One AI</title>
<link rel="stylesheet" href="style.css?v=4">
<style>
body {
background:
radial-gradient(ellipse 80% 55% at 15% 5%, rgba(124,58,237,.18) 0%, transparent 60%),
radial-gradient(ellipse 60% 50% at 85% 95%, rgba(99,102,241,.14) 0%, transparent 60%),
linear-gradient(160deg, #f8f7ff 0%, #eef2ff 65%, #f5f0ff 100%);
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: var(--text-primary);
letter-spacing: .5px;
}
.login-brand-name span { color: var(--brand); }
.login-brand-sub {
font-size: 13px;
color: var(--text-tertiary);
margin-top: 6px;
}
.login-card {
background:var(--navy2);
border: 1px solid var(--border);
border-radius: 16px;
padding: 36px 32px;
box-shadow: 0 24px 60px rgba(15,23,42,.16);
}
.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: var(--shadow-focus);
}
.login-btn {
width: 100%;
padding: 13px;
background: var(--brand);
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: var(--brand-hover); }
.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: var(--text-tertiary);
}
.login-footer a { color: var(--text-secondary); }
.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">
🔒 &nbsp;Secure · on-premises · air-gapped capable
</div>
</div>
<div class="login-footer">
Nexus One AI &nbsp;·&nbsp; Powered by Cezen &nbsp;·&nbsp; <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>