Refactoring - Fix2

Dieser Commit ist enthalten in:
2025-06-18 00:07:34 +02:00
Ursprung 0ec0d2c267
Commit a9cfecc699
18 geänderte Dateien mit 1412 neuen und 337 gelöschten Zeilen

Datei anzeigen

@@ -140,87 +140,87 @@
<table class="table table-hover">
<thead>
<tr>
{{ sortable_header('Zeitstempel', 'timestamp', sort, order) }}
{{ sortable_header('Benutzer', 'username', sort, order) }}
{{ sortable_header('Aktion', 'action', sort, order) }}
{{ sortable_header('Entität', 'entity', sort, order) }}
<th>Zeitstempel</th>
<th>Benutzer</th>
<th>Aktion</th>
<th>Entität</th>
<th>Details</th>
{{ sortable_header('IP-Adresse', 'ip', sort, order) }}
<th>IP-Adresse</th>
</tr>
</thead>
<tbody>
{% for log in logs %}
<tr>
<td>{{ log[1].strftime('%d.%m.%Y %H:%M:%S') }}</td>
<td><strong>{{ log[2] }}</strong></td>
<td>{{ log.timestamp.strftime('%d.%m.%Y %H:%M:%S') }}</td>
<td><strong>{{ log.username }}</strong></td>
<td>
<span class="action-{{ log[3] }}">
{% if log[3] == 'CREATE' %} Erstellt
{% elif log[3] == 'UPDATE' %}✏️ Bearbeitet
{% elif log[3] == 'DELETE' %}🗑️ Gelöscht
{% elif log[3] == 'LOGIN' %}🔑 Anmeldung
{% elif log[3] == 'LOGOUT' %}🚪 Abmeldung
{% elif log[3] == 'AUTO_LOGOUT' %}⏰ Auto-Logout
{% elif log[3] == 'EXPORT' %}📥 Export
{% elif log[3] == 'GENERATE_KEY' %}🔑 Key generiert
{% elif log[3] == 'CREATE_BATCH' %}🔑 Batch erstellt
{% elif log[3] == 'BACKUP' %}💾 Backup erstellt
{% elif log[3] == 'LOGIN_2FA_SUCCESS' %}🔐 2FA-Anmeldung
{% elif log[3] == 'LOGIN_2FA_BACKUP' %}🔒 2FA-Backup-Code
{% elif log[3] == 'LOGIN_2FA_FAILED' %}⛔ 2FA-Fehlgeschlagen
{% elif log[3] == 'LOGIN_BLOCKED' %}🚫 Login-Blockiert
{% elif log[3] == 'RESTORE' %}🔄 Wiederhergestellt
{% elif log[3] == 'PASSWORD_CHANGE' %}🔐 Passwort geändert
{% elif log[3] == '2FA_ENABLED' %}✅ 2FA aktiviert
{% elif log[3] == '2FA_DISABLED' %}❌ 2FA deaktiviert
{% else %}{{ log[3] }}
<span class="action-{{ log.action }}">
{% if log.action == 'CREATE' %} Erstellt
{% elif log.action == 'UPDATE' %}✏️ Bearbeitet
{% elif log.action == 'DELETE' %}🗑️ Gelöscht
{% elif log.action == 'LOGIN' %}🔑 Anmeldung
{% elif log.action == 'LOGOUT' %}🚪 Abmeldung
{% elif log.action == 'AUTO_LOGOUT' %}⏰ Auto-Logout
{% elif log.action == 'EXPORT' %}📥 Export
{% elif log.action == 'GENERATE_KEY' %}🔑 Key generiert
{% elif log.action == 'CREATE_BATCH' %}🔑 Batch erstellt
{% elif log.action == 'BACKUP' %}💾 Backup erstellt
{% elif log.action == 'LOGIN_2FA_SUCCESS' %}🔐 2FA-Anmeldung
{% elif log.action == 'LOGIN_2FA_BACKUP' %}🔒 2FA-Backup-Code
{% elif log.action == 'LOGIN_2FA_FAILED' %}⛔ 2FA-Fehlgeschlagen
{% elif log.action == 'LOGIN_BLOCKED' %}🚫 Login-Blockiert
{% elif log.action == 'RESTORE' %}🔄 Wiederhergestellt
{% elif log.action == 'PASSWORD_CHANGE' %}🔐 Passwort geändert
{% elif log.action == '2FA_ENABLED' %}✅ 2FA aktiviert
{% elif log.action == '2FA_DISABLED' %}❌ 2FA deaktiviert
{% else %}{{ log.action }}
{% endif %}
</span>
</td>
<td>
{{ log[4] }}
{% if log[5] %}
<small class="text-muted">#{{ log[5] }}</small>
{{ log.entity_type }}
{% if log.entity_id %}
<small class="text-muted">#{{ log.entity_id }}</small>
{% endif %}
</td>
<td class="audit-details">
{% if log[10] %}
<div class="mb-1"><small class="text-muted">{{ log[10] }}</small></div>
{% if log.additional_info %}
<div class="mb-1"><small class="text-muted">{{ log.additional_info }}</small></div>
{% endif %}
{% if log[6] and log[3] == 'DELETE' %}
{% if log.old_values and log.action == 'DELETE' %}
<details>
<summary>Gelöschte Werte</summary>
<div class="json-display">
{% for key, value in log[6].items() %}
{% for key, value in log.old_values.items() %}
<strong>{{ key }}:</strong> {{ value }}<br>
{% endfor %}
</div>
</details>
{% elif log[6] and log[7] and log[3] == 'UPDATE' %}
{% elif log.old_values and log.new_values and log.action == 'UPDATE' %}
<details>
<summary>Änderungen anzeigen</summary>
<div class="json-display">
<strong>Vorher:</strong><br>
{% for key, value in log[6].items() %}
{% if log[7][key] != value %}
{% for key, value in log.old_values.items() %}
{% if log.new_values[key] != value %}
{{ key }}: {{ value }}<br>
{% endif %}
{% endfor %}
<hr class="my-1">
<strong>Nachher:</strong><br>
{% for key, value in log[7].items() %}
{% if log[6][key] != value %}
{% for key, value in log.new_values.items() %}
{% if log.old_values[key] != value %}
{{ key }}: {{ value }}<br>
{% endif %}
{% endfor %}
</div>
</details>
{% elif log[7] and log[3] == 'CREATE' %}
{% elif log.new_values and log.action == 'CREATE' %}
<details>
<summary>Erstellte Werte</summary>
<div class="json-display">
{% for key, value in log[7].items() %}
{% for key, value in log.new_values.items() %}
<strong>{{ key }}:</strong> {{ value }}<br>
{% endfor %}
</div>
@@ -228,7 +228,7 @@
{% endif %}
</td>
<td>
<small class="text-muted">{{ log[8] or '-' }}</small>
<small class="text-muted">{{ log.ip_address or '-' }}</small>
</td>
</tr>
{% endfor %}