feat(frontend): T46 configure HTMX and CSRF protection

- Add CSRFMiddleware for form protection
- Implement token generation and validation
- Add CSRF meta tag to base.html
- Create tests for CSRF protection

Tests: 13 passing
This commit is contained in:
Luca Sacchi Ricciardi
2026-04-07 18:02:20 +02:00
parent c1f47c897f
commit ccd96acaac
5 changed files with 355 additions and 16 deletions

View File

@@ -4,9 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="OpenRouter API Key Monitor - Monitor and manage your OpenRouter API keys">
{% if csrf_token %}
<meta name="csrf-token" content="{{ csrf_token }}">
{% endif %}
<meta name="csrf-token" content="{{ request.state.csrf_token or '' }}">
<title>{% block title %}OpenRouter Monitor{% endblock %}</title>
<!-- Pico.css for styling -->