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

{% block title %}Login{% endblock %}

{% block stylesheets %}
<link href='{{ asset('css/login.css') }}' rel='stylesheet'/>
<link href="{{ asset('css/main.css') }}" rel="stylesheet" />
{% endblock %}

{% block javascripts %}
<script src="{{ asset('js/login.js') }}"></script>
<script src="{{ asset('js/jquery.min.js') }}"></script>
<script src="{{ asset('js/browser.min.js') }}"></script>
<script src="{{ asset('js/breakpoints.min.js') }}"></script>
<script src="{{ asset('js/util.js') }}"></script>
<script src="{{ asset('js/main.js') }}"></script>
{% endblock %}

{% block body %}
<div class="container">

    <header>
        <h1>Login</h1>
    </header>

    <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">
                You are logged in as {{ app.user.userIdentifier }}, <a href="{{ path('app_logout') }}">Logout</a>
            </div>
        {% endif %}

        <fieldset>
            <label for="username">Email:</label>
            <input type="email" value="{{ last_username }}" name="_username" id="username" class="form-control" autocomplete="email" required autofocus>
            <label for="password">Password:</label>
            <input type="password" name="_password" id="password" class="form-control" autocomplete="current-password" required>
            <input type="hidden" name="_csrf_token"
                value="{{ csrf_token('authenticate') }}"
            >
            <button class="btn btn-lg btn-primary" type="submit">Sign in</button>
            <button class="btn btn-lg btn-primary" id='back'>Back</button>
        </fieldset>
    </form>
</div>
{% endblock %}