Enhance search functionality with case-insensitive title search and security improvements

- Add case-insensitive search across all fields (inhalt, titel, geltungsbereich)
- Include Vorgabe.titel field in search scope for better coverage
- Implement comprehensive input validation against SQL injection and XSS
- Add German error messages for validation failures
- Escape search terms in templates to prevent XSS attacks
- Add input length limits and character validation
- Preserve user input on validation errors for better UX
This commit is contained in:
2025-11-04 12:54:44 +01:00
parent 28a1bb4b62
commit 671d259c44
2 changed files with 56 additions and 8 deletions

View File

@@ -2,6 +2,12 @@
{% block content %}
<h1 class="mb-4">Suche</h1>
{% if error_message %}
<div class="alert alert-danger">
<strong>Fehler:</strong> {{ error_message }}
</div>
{% endif %}
<!-- Search form -->
<form action="." method="post">
{% csrf_token %}
@@ -13,7 +19,9 @@
id="query"
name="q"
placeholder="Suchbegriff eingeben …"
required>
value="{{ search_term|default:'' }}"
required
maxlength="200">
</div>
<button type="submit" class="btn btn-primary">Suchen</button>
</form>