{% extends 'user/base.html.twig' %}

{% block title %}
    {{ 'parthenon.user.login.title'|trans }}
{% endblock %}

{% block body %}
    <style>
        html,
        body {
            height: 100%;
        }

        body {
            display: -ms-flexbox;
            display: flex;
            -ms-flex-align: center;
            align-items: center;
            padding-top: 40px;
            padding-bottom: 40px;
            background-color: #f5f5f5;
        }

        .form-signin {
            width: 100%;
            max-width: 330px;
            padding: 15px;
            margin: auto;
        }
        .form-signin .checkbox {
            font-weight: 400;
        }
        .form-signin .form-control {
            position: relative;
            box-sizing: border-box;
            height: auto;
            padding: 10px;
            font-size: 16px;
        }
        .form-signin .form-control:focus {
            z-index: 2;
        }
        .form-signin input[type="email"] {
            margin-bottom: -1px;
            border-bottom-right-radius: 0;
            border-bottom-left-radius: 0;
        }
        .form-signin input[type="password"] {
            margin-bottom: 10px;
            border-top-left-radius: 0;
            border-top-right-radius: 0;
        }
    </style>

    <form method="post"  class="form-signin">
        {% if error %}
            <div class="alert alert-danger">{{ "parthenon.user.login.error"|trans }}</div>
            <div class="alert alert-danger" id="user-login-error">{{ error.messageKey|trans(error.messageData, 'security') }}</div>
        {% endif %}

{# TODO localise #}

        <h1 class="h3 mb-3 font-weight-normal">
            {{ 'parthenon.user.login.please_login'|trans }}
        </h1>
        <label for="inputEmail" class="sr-only">{{ 'parthenon.user.login.form.label.email'|trans }}</label>
        <input type="email" value="{{ last_username }}" name="email" id="inputEmail" class="form-control" placeholder="{{ 'parthenon.user.login.form.placeholder.email'|trans }}" required autofocus>
        <label for="inputPassword" class="sr-only">{{ 'parthenon.user.login.form.label.password'|trans }}</label>
        <input type="password" name="password" id="inputPassword" class="form-control" placeholder="{{ 'parthenon.user.login.form.placeholder.password'|trans }}" required>

        <input type="hidden" name="_csrf_token"
               value="{{ csrf_token('authenticate') }}"
        >

        {#

            <div class="checkbox mb-3">
                <label>
                    <input type="checkbox" name="_remember_me"> {{ 'cornerstone.user.login.form.remember_me'|trans }}
                </label>
            </div>
        #}

        <button class="btn btn-lg btn-primary" name="user_login_submit" type="submit">
            {{ 'parthenon.user.login.form.submit'|trans }}
        </button>
    </form>
{% endblock %}
