diff --git a/site/admin.html b/site/admin.html index a6b5a9e..97b30d6 100644 --- a/site/admin.html +++ b/site/admin.html @@ -97,7 +97,7 @@ async function api(path){ const r = await fetch('/admin'+path, { headers: hdr() let ROLE = 'staff'; async function signin(){ - TOKEN = $('#tok') ? $('#tok').value.trim() : TOKEN; + TOKEN = ($('#tok') && $('#tok').value.trim()) || TOKEN; // keep the stored token if the box is empty let me; try { me = await api('/me'); } catch(e){ localStorage.removeItem('rg_token'); location.replace('/login'); return; } ROLE = me.role || 'staff'; localStorage.setItem('rg_token', TOKEN);