{#
    require recaptach_display
#}
{% extends "login/layout/middle-bar-layout.html.twig" %}

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

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

{% block content %}
    <div class="well-large sidebar-block text-center">
        <div class="row-fluid">
            <div class="span12">
                {% block footer_logo %}
                    {{ parent() }}
                {% endblock footer_logo %}
            </div>
        </div>
    </div>
    <div class="well-large sidebar-block">
        <div class="row-fluid">
            <div class="span12 authentication-sidebar-title">
                <div class="text-title">
                    {{ "Hi, Please log in" | trans }}
                </div>
            </div>
        </div>
        <div class="row-fluid">
            <div class="span12">
                {{ auth_macro.flashes() }}
                <form
                     novalidate
                     name="loginForm"
                     method="POST"
                     action="{{ path("login_authenticate") }}"
                >
                    {% 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.email, "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") }}">
                            {{ "Forgot password?" | trans }}
                        </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">
                                {{ "Connection" | trans }}
                            </button>
                        </div>
                    </div>
                    <div class="row-fluid">
                        <div class="span12">
                            {{ auth_macro.checkboxInput(form['remember-me']) }}
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
    {% if authentication_providers | count > 0 %}
    <div class="well-large sidebar-block">
        <div class="row-fluid">
            <div class="span12 text-center">
                {{ "Or login with" | trans }}
            </div>
        </div>
        <div class="row-fluid">
            <div class="span12 text-center">
                {{ auth_macro.providerList() }}
            </div>
        </div>
    </div>
    {% endif %}
    <div class="well-large sidebar-block text-center">
        <div class="row-fluid">
            <div class="span12">
                {% block tou_link %}
                    {{ parent() }}
                {% endblock tou_link %}
            </div>
        </div>
    </div>
    <div class="well-large sidebar-block text-center">
        <div class="row-fluid">
            <div class="span12">
                {% block copyright %}
                    {{ parent() }}
                {% endblock copyright %}
            </div>
        </div>
    </div>
{% endblock %}

{% block footer_scaffholding %}
    {# empty footer #}
{% endblock footer_scaffholding %}

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