{% extends "PackagistWebBundle:user:packages.html.twig" %}

{% import "PackagistWebBundle::macros.html.twig" as macros %}

{% block content %}
    {% set isActualUser = app.user and app.user.username is same as(user.username) %}

    <h2 class="title">
        {{ user.username }}
        {%- if not isActualUser %}
            <small>
                member since: {{ user.createdAt|date('M d, Y') }}
                {%- if is_granted('ROLE_ADMIN') %}
                    <a href="mailto:{{ user.email }}">{{ user.email }}</a>
                {%- endif %}
            </small>
        {%- endif %}
    </h2>

    <section class="row">
        {% if isActualUser %}
            <section class="col-md-3">
                {{ knp_menu_render('profile_menu', {currentClass: 'active', allow_safe_labels: true}) }}
            </section>
        {% endif %}

        <section class="{{ isActualUser ? 'col-md-9' : 'col-md-12' }}">
            <h3 class="text-danger">Are you sure you wish to disable two-factor authentication?</h3>

            <p>Your account is more secure when you need a password and a verification code to sign in. If you remove this extra layer of security, you will only be asked for a password when you sign in. It might be easier for someone to break into your account.</p>

            <p>If you'd like to proceed anyway, simply click the button below.</p>

            <div class="row">
                <div class="col-md-6">
                    <a class="btn btn-lg btn-inverse" href="{{ path('user_2fa_configure', {name: user.username}) }}">Nevermind, keep my account secure</a>
                </div>
                <div class="col-md-6">
                    <a href="{{ path('user_2fa_disable', {token: csrf_token('disable_2fa'), name: user.username}) }}" class="btn btn-block btn-danger btn-lg">
                        <span class="icon-lock-open"></span>
                        Disable two-factor authentication
                    </a>
                </div>
            </div>


        </section>
    </section>
{% endblock %}
