{% extends 'base.html.twig' %}
{% block title %}Log in!{% endblock %}
{% block body %}
<div class="container mx-auto" style="margin: 150px 0;" id="{{ app.request.get('type') }}">
<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 %}
<h1 class="h3 mb-3 font-weight-normal">Je me connecte à mon compte</h1>
<label for="inputEmail">Email</label>
<input type="email" value="{{ last_username }}" name="email" id="inputEmail" class="form-control" autocomplete="email" required autofocus><br>
<label for="inputPassword">Mot de passe</label>
<div class="input-group">
<input type="password" name="password" id="inputPassword" class="form-control" autocomplete="current-password" required>
<button class="btn btn-outline-secondary" type="button" id="togglePassword"><i class="fas fa-eye"></i></button>
</div>
<div id="emailHelp" class="form-text"><a href="forgot-Password.php" style="color: #F6249D;">Mot de passe oublié ?</a></div>
<input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}">
<br>
{#
Uncomment this section and add a remember_me option below your firewall to activate remember me functionality.
See https://symfony.com/doc/current/security/remember_me.html
<div class="checkbox mb-3">
<label>
<input type="checkbox" name="_remember_me"> Remember me
</label>
</div>
#}
<button class="btn btn-lg btn-primary" type="submit">Connexion</button>
</form>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
document.getElementById('togglePassword').addEventListener('click', function() {
var passwordField = document.getElementById('inputPassword');
var type = passwordField.getAttribute('type') === 'password' ? 'text' : 'password';
passwordField.setAttribute('type', type);
this.querySelector('i').classList.toggle('fa-eye-slash');
});
});
</script>
{% endblock %}