{% extends 'auth/master.twig' %}
{% from 'macros.twig' import container_title %}
{% from '_layout/input.twig' import input_hidden, input_csrf, input_text %}

{% set title = 'Two Factor Authentication' %}

{% block content %}
    <form class="container auth__container auth__twofactor" method="post" action="{{ url('auth-two-factor') }}">
        {{ container_title('<i class="fas fa-user-shield fa-fw"></i> Two Factor Authentication') }}

        {{ input_csrf() }}
        {{ input_hidden('twofactor[redirect]', twofactor_redirect) }}
        {{ input_hidden('twofactor[token]', twofactor_token) }}

        {% if twofactor_notices|length > 0 %}
            <div class="warning auth__warning">
                <div class="warning__content">
                    {% for notice in twofactor_notices %}
                        <p class="auth__warning__paragraph">{{ notice }}</p>
                    {% endfor %}
                </div>
            </div>
        {% endif %}

        <label class="auth__label">
            <div class="auth__label__text">
               Code
            </div>
            <div class="auth__label__value">
                {{ input_text('twofactor[code]', 'input__text--monospace input__text--centre auth__label__input', '', 'text', '', true, {'maxlength': 6, 'inputmode': 'numeric'}, 1) }}
            </div>
        </label>

        <div class="auth__buttons">
            <button class="input__button auth__buttons__button" tabindex="2">Log in</button>
            <a href="{{ url('auth-login') }}" class="input__button auth__buttons__button auth__buttons__button--minor" tabindex="3">Log out</a>
        </div>
    </div>
{% endblock %}
