Отладка: console.log в doLogin + onclick на кнопке
This commit is contained in:
parent
8e460986ac
commit
f6e3a22544
@ -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 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="text" id="loginUser" placeholder="Введите логин" autocomplete="username"></div>
|
||||||
<div class="form-group"><label>Пароль</label><input type="password" id="loginPass" placeholder="Введите пароль" autocomplete="current-password"></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 id="loginError" class="login-error">Неверный логин или пароль</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="formRegister" class="login-form">
|
<div id="formRegister" class="login-form">
|
||||||
@ -705,8 +705,10 @@ function doRegister(){
|
|||||||
setTimeout(()=>{switchLoginTab('login');ok.style.display='none'},2000);
|
setTimeout(()=>{switchLoginTab('login');ok.style.display='none'},2000);
|
||||||
}
|
}
|
||||||
function doLogin(){
|
function doLogin(){
|
||||||
const u=document.getElementById('loginUser').value.trim().toLowerCase();
|
var u=document.getElementById('loginUser').value.trim().toLowerCase();
|
||||||
const p=document.getElementById('loginPass').value.trim();const err=document.getElementById('loginError');
|
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}
|
const all=getAllUsers();if(!all[u]||all[u].pass!==p){err.style.display='block';return}
|
||||||
err.style.display='none';currentUser={login:u,...all[u]};
|
err.style.display='none';currentUser={login:u,...all[u]};
|
||||||
localStorage.setItem('safetyAuditUser',JSON.stringify(currentUser));
|
localStorage.setItem('safetyAuditUser',JSON.stringify(currentUser));
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user