add password protection (KTdash1)
Some checks are pending
Deploy to Gitea Pages / deploy (push) Waiting to run

This commit is contained in:
kyrykbaev 2026-06-01 06:33:35 +00:00
parent d8d2fc34dd
commit 0e875e6555

View File

@ -213,7 +213,19 @@ body { font-family: var(--font-base); background: var(--color-bg); color: var(--
<body>
<!-- LOADING -->
<div id="loading-screen">
<!-- LOGIN -->
<div id="login-screen">
<div class="upload-box">
<div class="upload-logo">KT</div>
<h1>KPI InDigiCo</h1>
<p>Казахтелеком · 2026</p>
<input type="password" id="login-password" class="api-key-input" placeholder="Введите пароль" style="text-align:center;font-size:16px;margin-bottom:12px;">
<button class="btn-primary" id="btn-login" style="width:auto;padding:12px 40px;">Войти</button>
<p id="login-error" style="color:var(--color-red);font-size:13px;margin-top:10px;min-height:18px;"></p>
</div>
</div>
<div id="loading-screen" style="display:none">
<div class="loading-box">
<div class="spinner-lg"></div>
<p>Загрузка данных KPI...</p>
@ -1334,8 +1346,36 @@ document.getElementById('btn-ai-copy').addEventListener('click',()=>{
});
});
// ═══════════════════ LOGIN ═══════════════════
const LOGIN_PASSWORD = 'KTdash1';
function handleLogin() {
const input = document.getElementById('login-password');
const err = document.getElementById('login-error');
if (input.value === LOGIN_PASSWORD) {
document.getElementById('login-screen').style.display = 'none';
document.getElementById('loading-screen').style.display = 'flex';
if (sessionStorage) sessionStorage.setItem('kpi_auth', '1');
tryAutoLoad();
} else {
err.textContent = 'Неверный пароль';
input.value = '';
}
}
document.getElementById('btn-login').addEventListener('click', handleLogin);
document.getElementById('login-password').addEventListener('keydown', function(e) {
if (e.key === 'Enter') handleLogin();
});
// ═══════════════════ BOOT ═══════════════════
document.addEventListener('DOMContentLoaded', tryAutoLoad);
document.addEventListener('DOMContentLoaded', function() {
if (sessionStorage && sessionStorage.getItem('kpi_auth') === '1') {
document.getElementById('login-screen').style.display = 'none';
document.getElementById('loading-screen').style.display = 'flex';
tryAutoLoad();
}
});
</script>
</body>
</html>