Interfaccia web, parte 1: ospite, sicurezza, API, modalità dimostrativa, libreria, visualizzatore e account
Febe.Web: AddFebeWeb/UseFebe/FebeWebHost per le due vesti, interfaccia incorporata con IFileProvider proprio, indirizzi italiani, API JSON con contesto generato, eventi SSE, controlli di Host/Origin, gettone del desktop e password con blocco (§13.1), INativeShell e capacità per veste. Modalità --demo con 38 account e circa 18.000 elementi finti e scene del motore. Pagine Libreria, Visualizzatore, Account, Aggiungi account e Scheda account (contenuti, impostazioni con piano, cronologia); schermate in docs/schermate con le differenze dai mockup; prove delle API, della sicurezza, dell'esportazione CSV e dei dati dimostrativi. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Mzbb6zeFTjT6Rp8b92AVkA
This commit is contained in:
76 files changed
+12503
-17
No files matched your search
@@ -0,0 +1,51 @@
|
||||
// The login page of the Docker interface (spec §13.1): one password, an HttpOnly SameSite=Strict session cookie set
|
||||
// by the server, lockout after repeated failures. Nothing is stored by this page.
|
||||
|
||||
import { h, fill, brand } from './core/dom.js';
|
||||
import { loadTexts, t } from './core/text.js';
|
||||
|
||||
async function boot() {
|
||||
await loadTexts('it');
|
||||
const root = document.getElementById('app');
|
||||
const password = h('input', { type: 'password', id: 'password', autocomplete: 'current-password', required: true, autofocus: true });
|
||||
const message = h('p.aiuto', { role: 'alert', style: { color: 'var(--rosso)', minHeight: '20px' } });
|
||||
const button = h('button.btn.primo.grande', { type: 'submit', style: { width: '100%', justifyContent: 'center' } }, t('accesso.entra'));
|
||||
const form = h('form.pannello', { style: { width: 'min(360px, calc(100vw - 32px))', padding: '28px', display: 'flex', flexDirection: 'column', gap: '12px' } },
|
||||
h('div.marchio', { style: { padding: '0 0 6px' } }, brand(), h('b', t('app.nome'))),
|
||||
h('h1', { style: { margin: '0', fontSize: '20px', fontWeight: '650' } }, t('accesso.titolo')),
|
||||
h('label.etichetta', { for: 'password' }, t('accesso.password')),
|
||||
h('div.campo', password),
|
||||
h('p.aiuto', t('accesso.aiuto')),
|
||||
message,
|
||||
button);
|
||||
form.addEventListener('submit', async (e) => {
|
||||
e.preventDefault();
|
||||
button.disabled = true;
|
||||
message.textContent = '';
|
||||
try {
|
||||
const response = await fetch('/api/accesso', {
|
||||
method: 'POST',
|
||||
credentials: 'same-origin',
|
||||
headers: { 'Content-Type': 'application/json', Accept: 'application/json' },
|
||||
body: JSON.stringify({ password: password.value }),
|
||||
});
|
||||
const data = await response.json().catch(() => ({}));
|
||||
if (response.ok && data.ok) {
|
||||
const back = new URLSearchParams(location.search).get('torna');
|
||||
location.href = back && back.startsWith('/') && !back.startsWith('//') ? back : '/libreria';
|
||||
return;
|
||||
}
|
||||
message.textContent = data.message || t('accesso.sbagliata');
|
||||
password.value = '';
|
||||
password.focus();
|
||||
} catch {
|
||||
message.textContent = t('comune.errore');
|
||||
} finally {
|
||||
button.disabled = false;
|
||||
}
|
||||
});
|
||||
root.style.cssText = 'min-height:100vh;display:flex;align-items:center;justify-content:center;padding:16px';
|
||||
fill(root, form);
|
||||
}
|
||||
|
||||
boot();
|
||||
Reference in new issue
Block a user