38 lines
1.9 KiB
HTML
38 lines
1.9 KiB
HTML
{% extends 'layout/base.html' %}
|
|
{% block title %}Аудит-лог{% endblock %}
|
|
{% block body %}
|
|
<div class="content" style="max-width:1100px">
|
|
{% include 'admin/_flash.html' %}
|
|
<div class="card">
|
|
<div class="card-head"><div class="card-title">Аудит-лог (последние {{ rows|length }})</div></div>
|
|
<div class="card-body" style="padding:0">
|
|
<table class="tbl">
|
|
<thead><tr><th>Время</th><th>Событие</th><th>User</th><th>IP</th><th>UA</th><th>Extra</th></tr></thead>
|
|
<tbody>
|
|
{% for r in rows %}
|
|
<tr>
|
|
<td style="font-size:12px;font-family:monospace;white-space:nowrap">{{ r.at.strftime('%d.%m %H:%M:%S') }}</td>
|
|
<td><span class="audit-ev audit-{{ 'ok' if r.event in ('login_ok','logout') else ('err' if 'fail' in r.event else 'info') }}">{{ r.event }}</span></td>
|
|
<td style="font-size:12px">{{ r.user_email or '—' }}</td>
|
|
<td style="font-size:12px;font-family:monospace">{{ r.ip or '—' }}</td>
|
|
<td style="font-size:11px;color:var(--color-text-secondary);max-width:300px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap" title="{{ r.user_agent }}">{{ r.user_agent[:60] }}</td>
|
|
<td style="font-size:11px;color:var(--color-text-tertiary)">{{ r.extra }}</td>
|
|
</tr>
|
|
{% else %}
|
|
<tr><td colspan="6" style="text-align:center;color:var(--color-text-tertiary);padding:24px">Лог пуст</td></tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<style>
|
|
.audit-ev{display:inline-block;font-size:11px;padding:1px 6px;border-radius:4px;font-family:monospace}
|
|
.audit-ok{background:#e8f5e9;color:#1b5e20}
|
|
.audit-err{background:#fce8e6;color:#9b2c2c}
|
|
.audit-info{background:var(--color-background-secondary);color:var(--color-text-secondary)}
|
|
body.dark .audit-ok{background:#0f3a18;color:#a8e8b9}
|
|
body.dark .audit-err{background:#3a1212;color:#f0a8a8}
|
|
</style>
|
|
{% endblock %}
|