panel: fix login field (duplicate id='login' on div+input broke browser login); compact login form CSS
This commit is contained in:
+6
-4
@@ -23,10 +23,12 @@ input[type=text],input[type=password],input[type=number],textarea{width:100%;bac
|
||||
input:focus,textarea:focus{outline:none;border-color:var(--acc)}
|
||||
label{display:block;color:var(--mut);font-size:12px;margin:0 0 5px}
|
||||
/* login */
|
||||
#login{min-height:100vh;display:flex;align-items:center;justify-content:center}
|
||||
.login-card{background:var(--card);border:1px solid var(--line);border-radius:16px;padding:36px;width:340px}
|
||||
#login{height:100vh;display:flex;align-items:center;justify-content:center}
|
||||
.login-card{background:var(--card);border:1px solid var(--line);border-radius:16px;padding:36px;width:340px;box-sizing:border-box}
|
||||
.login-card h1{margin:0 0 4px;font-size:22px}
|
||||
.login-card .sub{color:var(--mut);margin:0 0 24px;font-size:13px}
|
||||
.login-card label{display:block;color:var(--mut);font-size:12px;margin:0 0 5px}
|
||||
.login-card input{height:auto !important}
|
||||
/* layout */
|
||||
#app{display:flex;min-height:100vh}
|
||||
aside{width:220px;background:var(--side);border-right:1px solid var(--line);padding:20px 12px;display:flex;flex-direction:column;position:sticky;top:0;height:100vh}
|
||||
@@ -75,7 +77,7 @@ pre{background:#0b1016;border:1px solid var(--line);border-radius:12px;padding:1
|
||||
<h1>sdm-panel</h1>
|
||||
<p class="sub">stealth tunnel · управление сервером</p>
|
||||
<label>Логин</label>
|
||||
<input type="text" id="login" value="admin" onkeydown="if(event.key==='Enter')document.getElementById('pw').focus()">
|
||||
<input type="text" id="user" value="admin" onkeydown="if(event.key==='Enter')document.getElementById('pw').focus()">
|
||||
<label>Пароль</label>
|
||||
<input type="password" id="pw" onkeydown="if(event.key==='Enter')login()" autofocus>
|
||||
<br><br>
|
||||
@@ -280,7 +282,7 @@ function api(p, opt){ opt=opt||{};
|
||||
}
|
||||
function toast(msg,ok){const t=document.getElementById('toast');t.textContent=msg;t.className='show '+(ok?'ok':'err');setTimeout(()=>t.className='',2600)}
|
||||
function esc(s){return (s||'').replace(/[&<>"']/g,c=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c]))}
|
||||
function login(){fetch('/api/login',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({login:document.getElementById('login').value,password:document.getElementById('pw').value})})
|
||||
function login(){fetch('/api/login',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({login:document.getElementById('user').value,password:document.getElementById('pw').value})})
|
||||
.then(r=>r.json()).then(j=>{if(!j.token)throw new Error('неверные данные');TOK=j.token;localStorage.setItem('tok',j.token);showApp()}).catch(e=>toast(e.message,false))}
|
||||
function logout(){localStorage.removeItem('tok');TOK='';location.reload()}
|
||||
function showApp(){document.getElementById('login').classList.add('hidden');document.getElementById('app').classList.remove('hidden');tab('status')}
|
||||
|
||||
Reference in New Issue
Block a user