1(function () { 2 const { sendJSON } = window.CP; 3 const form = document.getElementById('login-form'); 4 const who = document.getElementById('who'); 5 const pin = document.getElementById('pin'); 6 const err = document.getElementById('login-err'); 7 const btn = document.getElementById('login-btn'); 8 const hint = document.getElementById('login-hint'); 9 10 // already logged in? go straight in. 11 fetch('/api/session').then((r) => r.json()).then((d) => { 12 if (d.authed) location.replace('/manager'); 13 }).catch(() => {}); 14 15 // No roster is exposed anymore â just surface a setup hint while APP_PIN is live. 16 fetch('/api/login-options').then((r) => r.json()).then((d) => { 17 if (d.setupAvailable && hint) { 18 hint.textContent = 'First-time setup: type any name + the setup PIN.'; 19 hint.hidden = false; 20 } 21 }).catch(() => {}); 22 23 form.addEventListener('submit', async (e) => { 24 e.preventDefault(); 25 err.textContent = ''; 26 if (!who.value.trim()) { err.textContent = 'Enter your first name.'; who.focus(); return; } 27 btn.disabled = true; btn.textContent = 'CHECKINGâ¦'; 28 try { 29 await sendJSON('POST', '/api/login', { name: who.value, pin: pin.value }); 30 location.replace('/manager'); 31 } catch (ex) { 32 err.textContent = ex.status === 429 ? 'Too many tries â wait a bit.' : 'Incorrect name or PIN. Try again.'; 33 pin.value = ''; pin.focus(); 34 btn.disabled = false; btn.textContent = 'UNLOCK'; 35 } 36 }); 37})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.