{% extends "base.html" %} {% from "macros.html" import icon, btn, badge %} {% block title %}{{ t('Active Admin Sessions') }} — {{ admin_site_name }}{% endblock %} {% block content %} {# ── Stat cards (standard .card .stat-card) ── #}
{{ t('Connected Users') }} {{ total_users }}
{{ t('Total Sessions') }} {{ total_sessions }}
{{ t('Mobile') }} {{ mobile_count }}
{{ t('Desktop') }} {{ desktop_count }}
{# ── Sessions table (standard list style) ── #}
{{ icon('shield-check', 16) }} {{ t('Active Sessions') }} ({{ sessions|length }})
{% if sessions %}
{% for sess in sessions %} {% set is_curr = (sess.sid == current_sid) %} {% endfor %}
{{ t('User') }} {{ t('Device') }} {{ t('IP / Location') }} {{ t('Activity') }} {{ t('ACTIONS') }}
{{ sess.user_name }} {% if sess.is_admin %}Admin{% endif %} {% if is_curr %} {{ t('This device') }} {% elif not sess.is_active %} {{ t('Disconnected') }} {% else %} {{ t('Active') }} {% endif %}
{{ sess.user_email }}
{% if sess.is_mobile %}{{ icon('smartphone', 14, 'muted') }}{% else %}{{ icon('laptop', 14, 'muted') }}{% endif %} {{ sess.browser_name }}{% if sess.os_name %} ({{ sess.os_name }}){% endif %}
{{ icon('globe', 12, 'muted') }} {{ sess.ip }}
{{ icon('map-pin', 12, 'muted') }} {{ sess.location }}
{{ sess.last_seen_str }} ({{ sess.last_seen_at_str }})
{{ t('Connected:') }} {{ sess.created_at_str }} · {{ sess.duration_str }}
{% if sess.is_active and not is_curr %}
{{ request.csrf_input() }}
{% endif %} {% if sess.is_active %}
{{ request.csrf_input() }}
{% endif %}
{% if total_pages > 1 %} {% endif %} {% else %}
{{ icon('shield-off', 48, 'empty-icon') }}

{{ t('No active sessions found') }}

{% endif %}
{% endblock %}