{# The FIDO2/WebAuthn authentication factor template. Displays the passkeys management. :param edited_user: The user being edited. :type edited_user: :class:`~canaille.core.models.User` #} {% extends theme('base.html') %} {% import 'macro/form.html' as fui %} {%- block title -%} {% if user.user_name == edited_user.user_name %} {%- trans %}My profile{% endtrans -%} {% else %} {%- trans %}User profile edition{% endtrans -%} {% endif %} {%- endblock -%} {% block submenu %} {% trans %}Personal information{% endtrans %} {% trans %}Account settings{% endtrans %} {% trans %}Authentication{% endtrans %} {% endblock %} {% block content %}

{% trans %}Passkeys{% endtrans %}

{% call fui.render_form(form, class_="info") %} {% if edited_user.webauthn_credentials %}
{% trans count=edited_user.webauthn_credentials|length %} You have {{ count }} passkey configured. {% pluralize %} You have {{ count }} passkeys configured. {% endtrans %}

{% trans %} Passkeys can be used for authentication. {% endtrans %} {% if edited_user.webauthn_credentials|length < 2 %} {% trans %} As they are unrecoverable in case of loss, it is generally recommended to register at least one additional backup key. {% endtrans %} {% endif %}

{% for credential in edited_user.webauthn_credentials %} {% endfor %}
{% trans %}Name{% endtrans %} {% trans %}Registered{% endtrans %} {% trans %}Last used{% endtrans %} {% trans %}Actions{% endtrans %}
{% call fui.render_button(form.fido2_rename_credential, credential.id, class_="ui icon button", formnovalidate=True, title=_("Rename")) %} {% endcall %}
{{ credential.created_at|datetimeformat }} {% if credential.last_used_at %} {{ credential.last_used_at|datetimeformat }} {% else %} {% trans %}Never{% endtrans %} {% endif %} {% call fui.render_button(form.fido2_confirm_credential, credential.id, class_="ui basic negative icon button", formnovalidate=True, title=_("Delete")) %} {% endcall %}
{% if edited_user.webauthn_credentials|length < config.CANAILLE.FIDO_MAX_CREDENTIALS %} {% call fui.render_button(form.action, "fido2-setup", class_="ui primary button", id="setup-fido2", formnovalidate=True) %} {% trans %}Add another key{% endtrans %} {% endcall %} {% else %}
{% trans %}Add another key{% endtrans %}
{% endif %} {% call fui.render_button(form.action, "fido2-reset-confirm", class_="ui basic negative button confirm", id="reset-fido2-all", formnovalidate=True) %} {% trans %}Remove all keys{% endtrans %} {% endcall %}
{% else %}
{% trans %} You have no passkey configured. Click on the following button to register your passkey. {% endtrans %}
{% call fui.render_button(form.action, "fido2-setup", class_="ui right floated primary button", id="setup-fido2", formnovalidate=True) %} {% trans %}Set-up{% endtrans %} {% endcall %}
{% endif %} {% endcall %}
{% endblock %}