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

{% block title %}Connexion{% endblock %}

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

    {% if app.user %}
        <div class="mb-3">
            Vous êtes connecté en tant que {{ app.user.userIdentifier }}, <a href="{{ logout_path() }}">Déconnexion</a>
        </div>
    {% endif %}

    <h1 class="h3 mb-3 font-weight-normal">Se connecter :</h1>
    <label for="inputUsername">Nom d'utilisateur</label>
    <input type="text" value="{{ last_username }}" name="username" id="inputUsername" class="form-control" autocomplete="username" required autofocus>
    <label for="inputPassword">Mot de passe</label>
    <input type="password" name="password" id="inputPassword" class="form-control" autocomplete="current-password" required>
    <input type="hidden" name="_csrf_token" data-controller="csrf-protection" value="{{ csrf_token('authenticate') }}">

    <button class="btn btn-lg btn-primary" type="submit">
        Se connecter
    </button>
</form>
{% endblock %}
