102 lines
4.2 KiB
HTML
102 lines
4.2 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="ru" data-theme="light">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
<title>Вход — ИИ-агент КФУ</title>
|
|
<link rel="stylesheet" href="design-system/kt-ai-fonts.css">
|
|
<link rel="stylesheet" href="design-system/kt-ai-tokens.css">
|
|
<link rel="stylesheet" href="design-system/kt-ai-components.css">
|
|
<link rel="stylesheet" href="design-system/kt-ai-page.css">
|
|
<link rel="stylesheet" href="design-system/vibe-theme.css">
|
|
<style>
|
|
a.kt-ai-btn { text-decoration: none; }
|
|
.kfu-login {
|
|
min-height: 100vh;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: var(--kt-ai-space-6, 24px);
|
|
background: var(--kt-ai-bg);
|
|
}
|
|
.kfu-login-card {
|
|
width: 100%;
|
|
max-width: 400px;
|
|
}
|
|
.kfu-login-logo {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 10px;
|
|
margin-bottom: var(--kt-ai-space-8, 28px);
|
|
}
|
|
.kfu-login-logo svg { width: 28px; height: 28px; }
|
|
.kfu-login-logo span { font-size: 15px; font-weight: 600; letter-spacing: -0.02em; color: var(--kt-ai-fg); }
|
|
.kfu-login h1 { font-size: 22px; margin: 0 0 6px; }
|
|
.kfu-login-sub { color: var(--kt-ai-fg-muted); font-size: 14px; margin: 0 0 var(--kt-ai-space-6, 24px); }
|
|
.kfu-form { display: flex; flex-direction: column; gap: var(--kt-ai-space-4, 14px); }
|
|
.kfu-err { color: var(--kt-ai-danger); font-size: 13px; margin: 0; min-height: 18px; }
|
|
.kfu-hint { margin-top: var(--kt-ai-space-6, 24px); font-size: 12px; color: var(--kt-ai-fg-faint, var(--kt-ai-fg-muted)); }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<script src="design-system/icons/kt-ai-icons.js"></script>
|
|
<div class="kfu-login">
|
|
<div class="kfu-login-card">
|
|
<div class="kfu-login-logo">
|
|
<svg viewBox="0 0 24 24" fill="none" aria-hidden="true"><path d="M4 19.5V6a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v13.5M2 19.5h20M8 8h4M8 12h4" stroke="var(--kt-ai-primary)" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg>
|
|
<span>ИИ-агент КФУ</span>
|
|
</div>
|
|
<h1>Вход в систему</h1>
|
|
<p class="kfu-login-sub">Квартальные отчёты дочерних компаний и сводный расчёт коэффициентов.</p>
|
|
<form class="kfu-form" id="loginForm" autocomplete="off">
|
|
<label class="kt-ai-field">
|
|
<span>Логин</span>
|
|
<input class="kt-ai-input" id="login" name="login" type="text" required autocomplete="username">
|
|
</label>
|
|
<label class="kt-ai-field">
|
|
<span>Пароль</span>
|
|
<input class="kt-ai-input" id="password" name="password" type="password" required autocomplete="current-password">
|
|
</label>
|
|
<p class="kfu-err" id="err" role="alert"></p>
|
|
<button class="kt-ai-btn" data-variant="primary" data-size="lg" type="submit" id="btn">Войти</button>
|
|
</form>
|
|
<p class="kfu-hint">Дочерние компании вносят отчёт своей компании. Сводящий видит дашборд и настройки.</p>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
(function () {
|
|
var form = document.getElementById("loginForm");
|
|
var errEl = document.getElementById("err");
|
|
var btn = document.getElementById("btn");
|
|
form.addEventListener("submit", function (e) {
|
|
e.preventDefault();
|
|
errEl.textContent = "";
|
|
btn.disabled = true;
|
|
btn.textContent = "Вход…";
|
|
fetch("api/login", {
|
|
method: "POST",
|
|
headers: { "Content-Type": "application/json" },
|
|
body: JSON.stringify({
|
|
login: document.getElementById("login").value,
|
|
password: document.getElementById("password").value
|
|
})
|
|
}).then(function (r) {
|
|
return r.json().then(function (b) { return { ok: r.ok, b: b }; });
|
|
}).then(function (o) {
|
|
if (o.ok && o.b && o.b.ok) {
|
|
window.location.href = o.b.role === "consolidator" ? "dashboard.html" : "upload.html";
|
|
return;
|
|
}
|
|
errEl.textContent = (o.b && o.b.error) || "Ошибка входа";
|
|
}).catch(function () {
|
|
errEl.textContent = "Сервер недоступен. Проверьте соединение.";
|
|
}).finally(function () {
|
|
btn.disabled = false;
|
|
btn.textContent = "Войти";
|
|
});
|
|
});
|
|
})();
|
|
</script>
|
|
</body>
|
|
</html>
|