Simon C4: nell'inventario DUE sole voci principali; le sottoclassi le crea l'utente.
Riconduzione concordata (no perdita di dettaglio): hardware/network/facility -> ID.AM-01;
software/service/data -> ID.AM-02; personnel -> Organigramma (0 asset personnel presenti).
- Config: cfg_inventory_voci (2: ID.AM-01 Hardware, ID.AM-02 Software/Servizi/Sistemi),
inventory_subclassi (12 default di sistema org NULL + sottoclassi org-scoped).
- assets.voce_code + subclass_id (FK). 20 asset esistenti MIGRATI (5 ID.AM-01 / 15 ID.AM-02).
- AssetController: list con label voce/sottoclasse; create/update validati (voce in whitelist,
sottoclasse appartenente a org/default+voce); GET/POST /assets/subclasses; import (bulkUpsert)
deriva la voce dal tipo legacy. asset_type resta come campo legacy (viste secondarie).
- assets.html: filtro per voce, form con selettore Voce + Sottoclasse (+ '+ aggiungi'),
lista/dettaglio mostrano 'voce · sottoclasse', stat-chips per voce.
- FIX bug pre-esistente: apostrofo non escapato ('l'inventario') che ROMPEVA tutto il JS
della pagina Inventario. + cache-buster common-bi.js (era a v=20260618, non bumpato dal fix C3).
Help + KB + i18n. Verifiche prod: subclasses 200, create voce/legacy OK, validazione 422,
JS valido (node --check), migrazione idempotente. version 1.18.4.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
126 lines
5.6 KiB
HTML
126 lines
5.6 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="it">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
|
<title>Password dimenticata - NIS2 Agile</title>
|
|
<!-- Bootstrap Italia v2.18.1 — self-hostato da /vendor (MAI CDN). Variante "-bi" della forgot-password.html. -->
|
|
<link rel="stylesheet" href="vendor/bootstrap-italia/dist/css/bootstrap-italia.min.css">
|
|
<style>
|
|
body { min-height: 100vh; display: flex; align-items: center; background: #f5f6f7; }
|
|
.auth-wrap { width: 100%; max-width: 460px; margin: 0 auto; padding: 24px; }
|
|
.auth-brand { text-align: center; margin-bottom: 24px; }
|
|
.auth-brand .brand-name { font-weight: 700; font-size: 1.5rem; color: #06c; }
|
|
.auth-brand .brand-name span { color: #17324d; }
|
|
.auth-brand .brand-sub { color: #5a6772; font-size: .9rem; margin-top: 4px; }
|
|
.ico { width: 1em; height: 1em; fill: currentColor; vertical-align: -.125em; }
|
|
</style>
|
|
<!-- PWA:start -->
|
|
<link rel="manifest" href="/manifest.webmanifest">
|
|
<meta name="theme-color" content="#0066CC">
|
|
<link rel="icon" type="image/png" sizes="32x32" href="/assets/icons/favicon-32.png">
|
|
<link rel="icon" type="image/png" sizes="16x16" href="/assets/icons/favicon-16.png">
|
|
<link rel="apple-touch-icon" sizes="180x180" href="/assets/icons/apple-touch-icon.png">
|
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
<meta name="mobile-web-app-capable" content="yes">
|
|
<meta name="apple-mobile-web-app-status-bar-style" content="default">
|
|
<meta name="apple-mobile-web-app-title" content="NIS2 Agile">
|
|
<meta name="application-name" content="NIS2 Agile">
|
|
<script src="/js/pwa.js?v=20260614" defer></script>
|
|
<!-- PWA:end -->
|
|
</head>
|
|
<body>
|
|
<main class="auth-wrap">
|
|
<div class="auth-brand">
|
|
<div class="brand-name">NIS2 <span>Agile</span></div>
|
|
<div class="brand-sub">Reimposta la tua password</div>
|
|
</div>
|
|
|
|
<div class="card card-bg has-bkg-grey shadow">
|
|
<div class="card-body">
|
|
<h1 class="h4 mb-3">Password dimenticata</h1>
|
|
|
|
<div class="alert alert-danger d-none" id="err" role="alert"></div>
|
|
<div class="alert alert-success d-none" id="ok" role="status"></div>
|
|
|
|
<p class="text-muted small mb-4">Inserisci l'indirizzo email associato al tuo account. Ti invieremo un link valido 30 minuti per impostare una nuova password.</p>
|
|
|
|
<form id="forgot-form" novalidate>
|
|
<div class="form-group">
|
|
<label for="email" class="active">Indirizzo Email</label>
|
|
<input type="email" id="email" name="email" class="form-control"
|
|
autocomplete="email" required aria-describedby="err">
|
|
</div>
|
|
|
|
<button type="submit" class="btn btn-primary w-100 mt-2" id="submit-btn">
|
|
Invia link
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<p class="text-center mt-3 mb-0">
|
|
<a href="login.html">
|
|
<svg class="ico me-1" aria-hidden="true"><use href="vendor/bootstrap-italia/dist/svg/sprites.svg#it-arrow-left"></use></svg>
|
|
Torna al login
|
|
</a>
|
|
</p>
|
|
</main>
|
|
|
|
<script src="vendor/bootstrap-italia/dist/js/bootstrap-italia.bundle.min.js"></script>
|
|
<script>
|
|
if (window.bootstrap && bootstrap.loadFonts) { bootstrap.loadFonts('vendor/bootstrap-italia/dist/fonts'); }
|
|
</script>
|
|
|
|
<!-- Stessa logica della forgot-password.html: ZERO modifiche backend -->
|
|
<script src="js/api.js?v=20260625"></script>
|
|
<script>
|
|
const form = document.getElementById('forgot-form');
|
|
const err = document.getElementById('err');
|
|
const ok = document.getElementById('ok');
|
|
const btn = document.getElementById('submit-btn');
|
|
|
|
form.addEventListener('submit', async function(e) {
|
|
e.preventDefault();
|
|
err.classList.add('d-none');
|
|
ok.classList.add('d-none');
|
|
|
|
const email = document.getElementById('email').value.trim();
|
|
if (!email) {
|
|
err.textContent = 'Inserisci l\'indirizzo email.';
|
|
err.classList.remove('d-none');
|
|
return;
|
|
}
|
|
|
|
btn.disabled = true;
|
|
btn.textContent = 'Invio in corso...';
|
|
try {
|
|
const res = await fetch('/api/auth/forgot-password', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ email: email })
|
|
});
|
|
const data = await res.json();
|
|
if (res.status === 429) {
|
|
err.textContent = data.message || 'Troppe richieste. Riprova più tardi.';
|
|
err.classList.remove('d-none');
|
|
} else if (data.success) {
|
|
ok.textContent = data.message;
|
|
ok.classList.remove('d-none');
|
|
form.style.display = 'none';
|
|
} else {
|
|
err.textContent = data.message || 'Errore. Riprova.';
|
|
err.classList.remove('d-none');
|
|
}
|
|
} catch (e) {
|
|
err.textContent = 'Errore di connessione al server.';
|
|
err.classList.remove('d-none');
|
|
} finally {
|
|
btn.disabled = false;
|
|
btn.textContent = 'Invia link';
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|