{% extends 'base.html.twig' %}
{% set menu = null %}

{% block body %}

{% if app.user %}
    <div class="mb-3">
        {{ "login.already"|trans({username: app.user.username}) }}, <a href="{{ path('app_logout') }}">{{ "logout"|trans }}</a>
    </div>
{% else %}
    <div class="row justify-content-md-center">
        <div class="col-md-6 col-lg-4">
            <form method="post">
                {% if error %}
                    <div class="alert alert-danger">{{ error.messageKey|trans(error.messageData, 'security') }}</div>
                {% endif %}

                <h1 class="h3 mb-3 font-weight-normal">{{ "login.signin"|trans }}</h1>

                <div class="form-group">
                    <label for="inputUsername" class="sr-only">{{ "login.username"|trans }}</label>
                    <input type="text" value="{{ last_username }}" name="username" id="inputUsername" class="form-control" placeholder="{{ "login.username"|trans }}" required autofocus>
                </div>
                <div class="form-group">
                    <label for="inputPassword" class="sr-only">{{ "login.password"|trans }}</label>
                    <input type="password" name="password" id="inputPassword" class="form-control" placeholder="{{ "login.password"|trans }}" required>
                </div>
                <button type="submit" class="btn btn-primary">{{ "login.submit"|trans }}</button>

                <input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}">
            </form>
        </div>
    </div>
{% endif %}

{% endblock %}
