{% trans_default_domain 'FOSUserBundle' %}

{# <h3>{{ 'word.custom.security.login.title'|trans({}, 'word') }}</h3> #}

<form action="{{ path("fos_user_security_check") }}" method="post">
    {% if error %}
    <div class="alert alert-danger">
        <ul>
            <li class="error">{{ error.messageKey|trans(error.messageData, 'security') }}</li>
        </ul>
    </div>
    {% endif %}

    <input type="hidden" name="_csrf_token" value="{{ csrf_token }}" />
    {# <input type="hidden" name="_return" value="{{ app.request.query.get('_return') }}" /> #}
    <input type="hidden" name="_return" value="{{ app.request.headers.get('referer')|base64_encode }}" />
    
    <div class="form-group row">
        <label class="col-form-label col-sm-4" for="username">{{ 'security.login.username'|trans }}</label>
        <div class="col-sm-8">
            <input type="text" id="username" class="form-control" name="_username" value="{{ last_username }}" required="required" />
        </div>
    </div>
    
    <div class="form-group row">
        <label class="col-form-label col-sm-4" for="password">{{ 'security.login.password'|trans }}</label>
        <div class="col-sm-8">
            <input type="password" id="password" class="form-control" name="_password" required="required" />
        </div>
    </div>
    
    <div class="form-group row">
        <div class="col-sm-4"></div>
        <div class="col-sm-8 text-right">
            <a href="{{ path('fos_user_resetting_request') }}" class="text-small" data-fancybox data-src="#password-request">
                {{ 'sentence.form.password.forgotten'|trans({}, 'sentence') }}
            </a>
        </div>
    </div>

    <div class="form-group row">
        <div class="col-sm-4">&nbsp;</div>
        <div class="col-sm-8">
            <div class="form-check">
                <input type="checkbox" id="remember_me_popin" class="form-check-color-la-rioja form-check-input" name="_remember_me" value="on" />
                <label for="remember_me_popin" class="form-check-label">{{ 'security.login.remember_me'|trans }}</label>
            </div>
        </div>
    </div>

    <div class="form-group row">
        <div class="col-sm-4"></div>
        <div class="col-sm-8">
            {{ include('Front/_component/button.html.twig', {
                type: 'button',
                class: 'btn-md btn-block btn-la-rioja',
                text: 'security.login.submit'|trans,
            }) }}
        </div>
    </div>
</form>

{# Must be included outside a form because it contains a form too #}
<div class="modal modal-password-request" id="password-request">
    {{ include('@FOSUser/_component/request.html.twig') }}
</div>