{% extends "base.html" %} {% from "macros.html" import icon, btn, badge %} {% block title %}{{ t('My Profile') }}{% endblock %} {% block content %}
{# Account form #}
{{ request.csrf_input() }}
{% if errors_global %}
{{ icon('alert-triangle', 18) }} {{ errors_global }}
{% endif %}
{{ icon('user', 12) }} {{ t('Account Details') }}
{% if form._fields.email %}
{{ form._fields.email.input(autocomplete='username') }} {% if form._fields.email._error %}
{{ icon('x', 14) }} {{ form._fields.email._error }}
{% endif %}
{% endif %} {% if form._fields.name %}
{{ form._fields.name.input(autocomplete='name') }} {% if form._fields.name._error %}
{{ icon('x', 14) }} {{ form._fields.name._error }}
{% endif %}
{% endif %}
{{ icon('shield', 12) }} {{ t('Security') }} {{ t('Leave blank to keep current password') }}
{{ form._fields.current_password.input(autocomplete='current-password') }} {% if form._fields.current_password._error %}
{{ icon('x', 14) }} {{ form._fields.current_password._error }}
{% endif %}
{{ form._fields.new_password.input(autocomplete='new-password') }} {% if form._fields.new_password._error %}
{{ icon('x', 14) }} {{ form._fields.new_password._error }}
{% endif %}
{{ form._fields.confirm_password.input(autocomplete='new-password') }} {% if form._fields.confirm_password._error %}
{{ icon('x', 14) }} {{ form._fields.confirm_password._error }}
{% endif %}
{# 2FA card #}
{{ icon('shield', 12) }} {{ t('Two-Factor Authentication') }}
{% if twofa_enabled %} {{ badge(t('Active'), 'success') }} {% else %} {{ badge(t('Inactive'), 'error') }} {% endif %}
{{ icon('shield', 32, 'empty-icon') }}
{% if twofa_enabled %}

{{ t('2FA is Enabled') }}

{{ t('Your account is secured with an extra layer of protection using a TOTP authenticator app.') }}

{{ request.csrf_input() }}
{{ btn(t('Disable 2FA'), 'danger', icon_name='trash', type='submit') }}
{% else %}

{{ t('Secure Your Account') }}

{{ t('Two-factor authentication adds an additional layer of security to your account by requiring more than just a password to log in.') }}

{{ icon('shield', 14) }} {{ t('Setup Two-Factor') }} {% endif %}
{# Active Sessions Card #}
{{ icon('monitor', 12) }} {{ t('Active Sessions') }}
{{ badge(active_sessions|length, 'info') }}
{% if active_sessions %} {% set has_other = [] %}
{% for sess in active_sessions %}
{% if sess.is_mobile %} {{ icon('smartphone', 20) }} {% else %} {{ icon('laptop', 20) }} {% endif %}
{{ sess.browser_name }}{% if sess.os_name %} ({{ sess.os_name }}){% endif %} {% if sess.sid == current_sid %} {{ t('This device') }} {% endif %}
IP: {{ sess.ip }} {{ t('Dernière activité:') if locale == 'fr' else t('Last active:') }} {{ sess.last_seen_str }} ({{ sess.last_seen_at_str }})
{% if sess.sid == current_sid %} {{ t('Active now') }} {% else %} {% do has_other.append(1) %}
{{ request.csrf_input() }}
{% endif %}
{% endfor %}
{% if not has_other %}

{{ t('No other active sessions.') }}

{% endif %} {% else %}

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

{% endif %}
{% endblock %}