Отладка: console.log в doLogin + onclick на кнопке

This commit is contained in:
Dauren777 2026-06-03 12:49:38 +00:00
parent 8e460986ac
commit f6e3a22544

View File

@ -200,7 +200,7 @@ body{font:15px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",Inter,system-ui,s
<div id="formLogin" class="login-form active">
<div class="form-group"><label>Логин</label><input type="text" id="loginUser" placeholder="Введите логин" autocomplete="username"></div>
<div class="form-group"><label>Пароль</label><input type="password" id="loginPass" placeholder="Введите пароль" autocomplete="current-password"></div>
<button id="loginBtn" class="btn btn-primary btn-block">Войти</button>
<button id="loginBtn" class="btn btn-primary btn-block" onclick="doLogin()">Войти</button>
<div id="loginError" class="login-error">Неверный логин или пароль</div>
</div>
<div id="formRegister" class="login-form">
@ -705,8 +705,10 @@ function doRegister(){
setTimeout(()=>{switchLoginTab('login');ok.style.display='none'},2000);
}
function doLogin(){
const u=document.getElementById('loginUser').value.trim().toLowerCase();
const p=document.getElementById('loginPass').value.trim();const err=document.getElementById('loginError');
var u=document.getElementById('loginUser').value.trim().toLowerCase();
var p=document.getElementById('loginPass').value.trim();
var err=document.getElementById('loginError');
console.log('doLogin called', u, p);
const all=getAllUsers();if(!all[u]||all[u].pass!==p){err.style.display='block';return}
err.style.display='none';currentUser={login:u,...all[u]};
localStorage.setItem('safetyAuditUser',JSON.stringify(currentUser));