{% extends "forms/field.html.twig" %}

{% block input %}
    <div class="form-input-wrapper twofa-wrapper">
        {% do admin.get2FAData(value) %}
        {% set data = admin.json_response %}
        {% if data.status == 'success' %}

            <img style="border: 1px solid #ddd" data-2fa-image src="{{ data.image }}" />
            <div>
                <span>{{ 'PLUGIN_ADMIN.2FA_SECRET'|tu }}: </span><span class="twofa-secret-code" data-2fa-secret>{{ data.secret }}</span>
            </div>
            <div class="danger">
                <button data-hint="{{ 'PLUGIN_ADMIN.2FA_REGEN_HINT'|tu }}" class="button button-small hint--bottom" data-2fa-regenerate><i class="fa fa-fw fa-refresh"></i> {{ 'PLUGIN_ADMIN.2FA_REGENERATE'|t }}</button>
            </div>
            <input type="text" style="display:none;" name="{{ (scope ~ field.name)|fieldName }}" data-2fa-value value="{{ data.secret|replace({' ':''}) }}" />

        {% else %}
            <div class="notice error">
                <p>{{ data.message }}</p>
            </div>
        {% endif %}
    </div>
{% endblock %}
