{% extends "login/layout/sidebar-layout.html.twig" %}

{% import "common/macros.html.twig" as macro %}
{% import "login/common/macros.html.twig" as auth_macro %}

{% block title %}
    {% trans "Login" %}
{% endblock %}

{% block sidebar %}
    <div class="well-large sidebar-block">
        <div class="row-fluid">
            <div class="span12">
                <div class="text-title">
                    {% trans "Connection" %}
                </div>
            </div>
        </div>
        <div class="row-fluid">
            <div class="span12">
                {{ auth_macro.providerBadge(token) }}
            </div>
        </div>
    </div>
    <div class="well-large sidebar-block">
        <div class="row-fluid">
            <div class="span12 sidebar-hint-large">
                {% trans "Login to link your account" %}
            </div>
        </div>
        <div class="row-fluid">
            <div class="span12">
                {{ auth_macro.flashes() }}
                <form
                    novalidate
                    name="loginForm"
                    action="{{ path('login_authentication_provider_do_bind', { 'providerId' : provider.getId() }) }}"
                    method="POST"
                >
                    {% if form.vars.errors|length > 0 %}
                        <div class="row-fluid">
                            <div class="span12">
                                {{ form_errors(form) }}
                            </div>
                        </div>
                    {% endif %}
                    <div class="row-fluid">
                        <div class="span12">
                            {{ auth_macro.fieldInput(form.login, "loginForm", 'icon-envelope') }}
                        </div>
                    </div>
                    <div class="row-fluid">
                        <div class="span12">
                            {{ auth_macro.fieldInput(form.password, "loginForm", 'icon-lock') }}
                        </div>
                    </div>
                    <div class="text-right">
                        <a class="forget-password-link" href="{{ path("login_forgot_password") }}">{% trans "Forgot password?" %}</a>
                    </div>
                    {% if recaptcha_display %}
                        <div class="row-fluid">
                            <div class="span12">
                                {{ macro.captcha() }}
                            </div>
                        </div>
                    {% endif %}

                    {{ form_rest(form) }}

                    <div class="row-fluid">
                        <div class="span12">
                            <button type="submit" class="btn btn-success btn-trigger">
                                {% trans "Connection" %}
                            </button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
    {% include "login/include/register-link-block.html.twig" with {"last_item" : register_enable} %}
{% endblock %}

{% block scripts %}
    {{ parent() }}
    <script type="text/javascript" src="{{ path('minifier', {'f': 'scripts/apps/login/home/bind.js'}) }}"></script>
{% endblock %}
