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

{% block pagewrapper %}
    
    <form action="{{ path('app_core_login') }}" method="post">

        <div class="d-flex flex-column m-auto" style="max-width:450px">
            <div style="text-align: center;margin-top: 100px;">
                <a href="{{ path("app_core_home") }}">
                <img id="logo" src="{{ asset(app.session.get('logo')) }}">
                
                <h1>{{ app.session.get('appname') }}</h1>
                </a>
            </div>


            <div class="login-card card">
                <div class="card-header">
                    <h3 class="card-title">Login</h3>
                </div>
                
                <div class="card-body">
                    <fieldset>
                        <label for="username">Login</label>
                        <input type="text" id="username" name="_username" value="{{ last_username }}"  class="form-control" style="margin-bottom:15px;" />

                        <label for="password">Password</label>
                        <input type="password" id="password" name="_password" class="form-control" style="margin-bottom:15px;" />

                        <input type="hidden" name="_target_path" value="account" />
                        <input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}">
               
                        <input type="submit" name="login" class="btn btn-success form-control" />
                    </fieldset>

                    {% if masteridentity == "SQL"%}
                        <a href="{{path("app_core_resetpwd01")}}" class="mt-3">Mot de passe oublié ?</a>
                    {% endif %}                      
                </div>
            </div>    

            {% if error %}
                <div>{{ error.messageKey|trans(error.messageData, 'security') }}</div>
            {% endif %}            
        </div>
    </form>
{% endblock %}

{% block localjavascript %}
    $("#username").focus();
{% endblock %}
