{# This template receives the following pieces of context in addition to the form: #} {% set title = title|default(_fsdomain("Setup New WebAuthn Security Key")) %} {% extends "security/base.html" %} {% from "security/_macros.html" import render_field_with_errors, render_field, render_field_errors, render_csrf %} {% block head_scripts %} {{ super() }} {% endblock head_scripts %} {% block content %} {% include "security/_messages.html" %}

{{ _fsdomain("Setup New WebAuthn Security Key") }}

{% if not credential_options %} {# Initial form to get CreateOptions #}
{{ _fsdomain("Start by providing a unique name for your new security key:") }}
{{ wan_register_form.hidden_tag() }} {{ render_field_with_errors(wan_register_form.name) }} {# Default is just second factor #} {% if config["SECURITY_WAN_ALLOW_AS_FIRST_FACTOR"] %}
{% for subfield in wan_register_form.usage %}{{ render_field_with_errors(subfield) }}{% endfor %}
{% endif %} {{ render_field(wan_register_form.submit) }}
{% else %}
{{ wan_register_response_form.hidden_tag() }}
{% endif %} {% if registered_credentials %}

{{ _fsdomain("Currently registered security keys:") }}

{% set listing = _fsdomain('Nickname: "%s" Usage: "%s" Transports: "%s" Discoverable: "%s" Device Type: "%s" Backed up? "%s" Last used on: %s') %} {% endif %} {% if wan_delete_form %}

{{ _fsdomain("Delete Existing WebAuthn Security Key") }}

{# explicitly render csrf_token so we can change the ID so we don't get duplicates #} {{ render_csrf(wan_delete_form, "delete") }} {{ render_field_with_errors(wan_delete_form.name) }} {{ render_field(wan_delete_form.submit) }}
{% endif %} {% if security.support_mfa and security.multi_factor_recovery_codes %}

{{ _fsdomain("Recovery Codes") }}

{{ _fsdomain("This application supports setting up recovery codes.") }} {{ _fsdomain("You can set them up here.") }}
{% endif %} {% include "security/_menu.html" %} {% endblock content %}