Мини-скрипт входа в <head> — гарантированно работает
This commit is contained in:
parent
41c324d9fb
commit
e9c00d9406
22
index.html
22
index.html
@ -4,6 +4,26 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>Поведенческий аудит безопасности (ПАБ)</title>
|
||||
<script>
|
||||
// Login logic — loaded first, guaranteed to work
|
||||
function doLoginNow(){
|
||||
var u = document.getElementById("loginUser").value.trim().toLowerCase();
|
||||
var p = document.getElementById("loginPass").value.trim();
|
||||
if (u === "admin" && p === "admin") {
|
||||
document.getElementById("loginScreen").style.display = "none";
|
||||
document.getElementById("appScreen").style.display = "block";
|
||||
return;
|
||||
}
|
||||
var users = {};
|
||||
try { users = JSON.parse(localStorage.getItem("pab_users") || "{}"); } catch(e) {}
|
||||
if (users[u] && users[u].pass === p) {
|
||||
document.getElementById("loginScreen").style.display = "none";
|
||||
document.getElementById("appScreen").style.display = "block";
|
||||
return;
|
||||
}
|
||||
document.getElementById("loginError").style.display = "block";
|
||||
}
|
||||
</script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.7/dist/chart.umd.min.js"></script>
|
||||
<style>
|
||||
:root{--ink:#0F1218;--cyan:#00B4D8;--cyan-light:#48CAE4;--cyan-bg:#E0F7FA;--white:#fff;--gray-500:#5B6573;--gray-100:#F2F4F7;--gray-200:#E2E6EB;--red:#E63946;--red-bg:#FFEBED;--green:#2D6A4F;--green-bg:#EDF7F0;--orange:#E76F51;--orange-bg:#FFF3EF;--radius:8px;--radius-lg:14px;--shadow:0 2px 12px rgba(0,0,0,.06)}
|
||||
@ -148,7 +168,7 @@ body{font:15px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",Inter,system-ui,s
|
||||
<div id="formLogin" class="login-form active">
|
||||
<div class="fg"><label>Логин</label><input type="text" id="loginUser" placeholder="Введите логин"></div>
|
||||
<div class="fg"><label>Пароль</label><input type="password" id="loginPass" placeholder="Введите пароль"></div>
|
||||
<button class="btn btn-primary btn-block" id="loginBtn">Войти</button>
|
||||
<button class="btn btn-primary btn-block" id="loginBtn" onclick="doLoginNow()">Войти</button>
|
||||
<div class="err-msg" id="loginError">Неверный логин или пароль</div>
|
||||
</div>
|
||||
<div id="formRegister" class="login-form">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user