index.html = точная копия test-login.html которая работает

This commit is contained in:
Dauren777 2026-06-04 04:53:04 +00:00
parent 3740f565ca
commit b8ddf82a38

View File

@ -3,81 +3,42 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Вход — ПАБ</title>
<title>ПАБ — Тест входа</title>
<style>
*{box-sizing:border-box;margin:0;padding:0}
body{font:16px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;display:flex;align-items:center;justify-content:center;min-height:100vh;background:linear-gradient(135deg,#0F1218 0%,#1a2332 100%)}
#loginCard{background:#fff;padding:44px 36px;border-radius:14px;width:100%;max-width:400px;box-shadow:0 8px 40px rgba(0,0,0,0.25)}
#loginCard h1{font-size:19px;text-align:center;margin-bottom:4px}
#loginCard .sub{font-size:13px;color:#5B6573;text-align:center;margin-bottom:24px}
#loginCard input{width:100%;padding:12px;margin-bottom:12px;border:2px solid #E2E6EB;border-radius:8px;font-size:14px;font-family:inherit;outline:none}
#loginCard input:focus{border-color:#00B4D8}
#loginCard button{width:100%;padding:12px;background:#00B4D8;color:#fff;border:none;border-radius:8px;font-size:15px;font-weight:700;cursor:pointer;font-family:inherit}
#loginCard button:hover{background:#48CAE4}
#lerr{color:#E63946;font-size:13px;text-align:center;display:none;margin-top:8px}
#regLink{text-align:center;margin-top:14px;font-size:12px;color:#5B6573}
#regLink a{color:#00B4D8;cursor:pointer;font-weight:600}
#regForm{display:none;margin-top:12px}
#regForm input,#regForm select{margin-bottom:10px}
#regForm select{width:100%;padding:10px;border:2px solid #E2E6EB;border-radius:8px;font-size:13px;font-family:inherit}
#rok{background:#EDF7F0;border:1px solid #2D6A4F;color:#2D6A4F;padding:10px;border-radius:8px;font-size:13px;text-align:center;display:none;margin-top:10px;font-weight:600}
#rerr{color:#E63946;font-size:13px;text-align:center;display:none;margin-top:8px}
body{font:16px/1.5 sans-serif;display:flex;align-items:center;justify-content:center;min-height:100vh;background:#0F1218}
.card{background:#fff;padding:40px;border-radius:12px;width:360px;box-shadow:0 8px 40px rgba(0,0,0,0.3)}
h1{font-size:20px;text-align:center;margin-bottom:24px}
input{width:100%;padding:10px;margin-bottom:12px;border:2px solid #ddd;border-radius:6px;font-size:14px;box-sizing:border-box}
button{width:100%;padding:12px;background:#00B4D8;color:#fff;border:none;border-radius:6px;font-size:15px;font-weight:700;cursor:pointer}
button:hover{background:#48CAE4}
.err{color:#E63946;font-size:13px;text-align:center;display:none;margin-top:8px}
</style>
</head>
<body>
<div id="loginCard">
<h1>🛡️ Поведенческий аудит безопасности</h1>
<div class="sub">Система ПАБ</div>
<input type="text" id="lu" placeholder="Логин">
<input type="password" id="lp" placeholder="Пароль">
<button id="lb">Войти</button>
<div id="lerr">Неверный логин или пароль</div>
<div id="regLink"><a id="regToggle">Зарегистрироваться</a></div>
<div id="regForm">
<input type="text" id="rl" placeholder="Придумайте логин">
<input type="password" id="rp" placeholder="Придумайте пароль (мин. 3 символа)">
<input type="text" id="rn" placeholder="ФИО">
<input type="email" id="re" placeholder="Email">
<select id="rr"><option value="">-- Должность --</option><option>Директор департамента ЦА</option><option>Директор департамента филиала</option><option>Региональный директор филиала</option><option>Директор ДЭСД</option><option>Начальник ТУСМ</option><option>Руководитель структурного подразделения</option><option>Начальник центра/службы/цеха</option><option>Начальник участка</option><option>Инженер БиОТ</option><option>Работник отдела БиОТ</option><option>Сотрудник</option></select>
<input type="text" id="rb" placeholder="Филиал">
<input type="text" id="rd" placeholder="Подразделение">
<input type="text" id="rg" placeholder="Регион">
<input type="text" id="ro" placeholder="Область">
<input type="text" id="rc" placeholder="Город / село">
<button id="rbb">Зарегистрироваться</button>
<div id="rerr"></div><div id="rok">Регистрация успешна! Теперь войдите.</div>
</div>
<div class="card">
<h1>🛡️ Вход в ПАБ</h1>
<input type="text" id="user" placeholder="Логин">
<input type="password" id="pass" placeholder="Пароль">
<button id="btn">Войти</button>
<div id="err" class="err">Неверный логин или пароль</div>
</div>
<script>
document.getElementById('lb').onclick = function(){
var u = document.getElementById('lu').value.trim().toLowerCase();
var p = document.getElementById('lp').value.trim();
if (u === 'admin' && p === 'admin') {
document.getElementById('btn').onclick = function(){
var u = document.getElementById('user').value.trim().toLowerCase();
var p = document.getElementById('pass').value.trim();
if(u==='admin' && p==='admin'){
sessionStorage.setItem('pab_user', JSON.stringify({login:'admin',name:'Администратор',role:'Руководитель',email:'admin@telecom.kz',branch:'АО «Казахтелеком»',dept:'ЦА',region:'Центральный',oblast:'—',city:'г. Астана'}));
window.location.href = 'app.html';
return;
} else {
var users = {}; try { users = JSON.parse(localStorage.getItem('pab_users') || '{}'); } catch(e) {}
if (users[u] && users[u].pass === p) {
sessionStorage.setItem('pab_user', JSON.stringify({login:u,name:users[u].name,role:users[u].role,email:users[u].email||'',branch:users[u].branch||'',dept:users[u].dept||'',region:users[u].region||'',oblast:users[u].oblast||'',city:users[u].city||''}));
window.location.href = 'app.html';
} else {
document.getElementById('err').style.display = 'block';
}
}
var users = {}; try{users = JSON.parse(localStorage.getItem('pab_users')||'{}');}catch(e){}
if (users[u] && users[u].pass === p) {
sessionStorage.setItem('pab_user', JSON.stringify({login:u,name:users[u].name,role:users[u].role,email:users[u].email||'',branch:users[u].branch||'',dept:users[u].dept||'',region:users[u].region||'',oblast:users[u].oblast||'',city:users[u].city||''}));
window.location.href = 'app.html';
return;
}
document.getElementById('lerr').style.display = 'block';
};
document.getElementById('lp').onkeydown = function(e){ if(e.key==='Enter') document.getElementById('lb').onclick(); };
document.getElementById('regToggle').onclick = function(){
var f = document.getElementById('regForm'); f.style.display = f.style.display === 'block' ? 'none' : 'block';
this.textContent = f.style.display === 'block' ? 'Скрыть' : 'Зарегистрироваться';
};
document.getElementById('rbb').onclick = function(){
var login=document.getElementById('rl').value.trim().toLowerCase(),pass=document.getElementById('rp').value.trim(),name=document.getElementById('rn').value.trim(),email=document.getElementById('re').value.trim(),role=document.getElementById('rr').value,branch=document.getElementById('rb').value.trim(),dept=document.getElementById('rd').value.trim(),region=document.getElementById('rg').value.trim(),oblast=document.getElementById('ro').value.trim(),city=document.getElementById('rc').value.trim();
var e=document.getElementById('rerr'),ok=document.getElementById('rok');ok.style.display='none';
if(!login||login.length<2){e.textContent='Логин мин. 2 символа';e.style.display='block';return}if(!pass||pass.length<3){e.textContent='Пароль мин. 3 символа';e.style.display='block';return}if(!name){e.textContent='Укажите ФИО';e.style.display='block';return}if(!role){e.textContent='Выберите должность';e.style.display='block';return}if(!email||email.indexOf('@')<0){e.textContent='Укажите Email';e.style.display='block';return}if(!branch){e.textContent='Укажите филиал';e.style.display='block';return}if(!region){e.textContent='Укажите регион';e.style.display='block';return}if(!city){e.textContent='Укажите город';e.style.display='block';return}if(!dept){e.textContent='Укажите подразделение';e.style.display='block';return}
var users={};try{users=JSON.parse(localStorage.getItem('pab_users')||'{}')}catch(e){}if(users[login]){e.textContent='Логин занят';e.style.display='block';return}e.style.display='none';
users[login]={pass:pass,name:name,email:email,role:role,branch:branch,dept:dept,region:region,oblast:oblast,city:city};localStorage.setItem('pab_users',JSON.stringify(users));
ok.style.display='block';document.getElementById('lu').value=login;
setTimeout(function(){ok.style.display='none';document.getElementById('regForm').style.display='none';document.getElementById('regToggle').textContent='Зарегистрироваться'},2000);
};
</script>
</body>