feat(frontend): T47-T54 implement web interface routes

- Add web router with all frontend pages
- Login/Register pages with form validation
- Dashboard with stats cards and Chart.js
- API Keys management with CRUD operations
- Stats page with filtering and pagination
- API Tokens management with generation/revocation
- User profile with password change and account deletion
- Add shared templates_config.py to avoid circular imports
- Add CSRF protection middleware
- Add get_current_user_optional dependency for web routes

All routes verified working:
- GET /login, POST /login
- GET /register, POST /register
- POST /logout
- GET /dashboard
- GET /keys, POST /keys, DELETE /keys/{id}
- GET /stats
- GET /tokens, POST /tokens, DELETE /tokens/{id}
- GET /profile, POST /profile/password, DELETE /profile
This commit is contained in:
Luca Sacchi Ricciardi
2026-04-07 18:15:26 +02:00
parent ccd96acaac
commit a605b7f29e
6 changed files with 919 additions and 15 deletions

View File

@@ -147,7 +147,7 @@
- Token revocato non funziona su API pubblica
- Test: 9 test passanti
### 🎨 Frontend Web (T44-T54) - 3/11 completati
### 🎨 Frontend Web (T44-T54) - 11/11 completati
- [x] T44: Setup Jinja2 templates e static files ✅ Completato (2026-04-07 16:00, commit: c1f47c8)
- Static files mounted on /static
- Jinja2Templates configured
@@ -156,18 +156,42 @@
- [x] T45: Creare base.html (layout principale) ✅ Completato (con T44)
- Base template con Pico.css, HTMX, Chart.js
- Components: navbar, footer
- [x] T46: HTMX e CSRF Protection ✅ Completato (2026-04-07 16:30)
- [x] T46: HTMX e CSRF Protection ✅ Completato (2026-04-07 16:30, commit: ccd96ac)
- CSRFMiddleware con validazione token
- Meta tag CSRF in base.html
- 13 tests passing
- [ ] T47: Pagina Login 🟡 In progress
- [ ] T48: Pagina Registrazione
- [ ] T49: Logout
- [ ] T50: Dashboard
- [ ] T51: Gestione API Keys
- [ ] T52: Statistiche Dettagliate
- [ ] T53: Gestione Token API
- [ ] T54: Profilo Utente
- [x] T47: Pagina Login ✅ Completato (2026-04-07 17:00)
- Route GET /login con template
- Route POST /login con validazione
- Redirect a dashboard dopo login
- [x] T48: Pagina Registrazione ✅ Completato (2026-04-07 17:00)
- Route GET /register con template
- Route POST /register con validazione
- Validazione password client-side
- [x] T49: Logout ✅ Completato (2026-04-07 17:00)
- Route POST /logout
- Cancella cookie JWT
- Redirect a login
- [x] T50: Dashboard ✅ Completato (2026-04-07 17:00)
- Route GET /dashboard (protetta)
- Card riepilogative con stats
- Grafici Chart.js
- [x] T51: Gestione API Keys ✅ Completato (2026-04-07 17:00)
- Route GET /keys con tabella
- Route POST /keys per creazione
- Route DELETE /keys/{id}
- [x] T52: Statistiche Dettagliate ✅ Completato (2026-04-07 17:00)
- Route GET /stats con filtri
- Tabella dettagliata usage
- Paginazione
- [x] T53: Gestione Token API ✅ Completato (2026-04-07 17:00)
- Route GET /tokens con lista
- Route POST /tokens per generazione
- Route DELETE /tokens/{id} per revoca
- [x] T54: Profilo Utente ✅ Completato (2026-04-07 17:00)
- Route GET /profile
- Route POST /profile/password
- Route DELETE /profile per eliminazione account
### ⚙️ Background Tasks (T55-T58) - 4/4 completati ✅
- [x] T55: Configurare APScheduler - ✅ Completato (2026-04-07 20:30)