templates/security/login.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block title %}Log in!{% endblock %}
  3. {% block body %}
  4. <div class="container mx-auto" style="margin: 150px 0;" id="{{ app.request.get('type') }}">
  5.     <form method="post">
  6.         {% if error %}
  7.             <div class="alert alert-danger">{{ error.messageKey|trans(error.messageData, 'security') }}</div>
  8.         {% endif %}
  9.         {% if app.user %}
  10.             <div class="mb-3">
  11.                 You are logged in as {{ app.user.userIdentifier }}, <a href="{{ path('app_logout') }}">Logout</a>
  12.             </div>
  13.         {% endif %}
  14.         <h1 class="h3 mb-3 font-weight-normal">Je me connecte à mon compte</h1>
  15.         <label for="inputEmail">Email</label>
  16.         <input type="email" value="{{ last_username }}" name="email" id="inputEmail" class="form-control" autocomplete="email" required autofocus><br>
  17.         <label for="inputPassword">Mot de passe</label>
  18.         <div class="input-group">
  19.             <input type="password" name="password" id="inputPassword" class="form-control" autocomplete="current-password" required>
  20.             <button class="btn btn-outline-secondary" type="button" id="togglePassword"><i class="fas fa-eye"></i></button>
  21.         </div>
  22.         <div id="emailHelp" class="form-text"><a href="forgot-Password.php" style="color: #F6249D;">Mot de passe oublié ?</a></div>
  23.         <input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}">
  24.         <br>
  25.         {#
  26.             Uncomment this section and add a remember_me option below your firewall to activate remember me functionality.
  27.             See https://symfony.com/doc/current/security/remember_me.html
  28.             <div class="checkbox mb-3">
  29.                 <label>
  30.                     <input type="checkbox" name="_remember_me"> Remember me
  31.                 </label>
  32.             </div>
  33.         #}
  34.         <button class="btn btn-lg btn-primary" type="submit">Connexion</button>
  35.     </form>
  36. </div>
  37. <script>
  38. document.addEventListener('DOMContentLoaded', function() {
  39.     document.getElementById('togglePassword').addEventListener('click', function() {
  40.         var passwordField = document.getElementById('inputPassword');
  41.         var type = passwordField.getAttribute('type') === 'password' ? 'text' : 'password';
  42.         passwordField.setAttribute('type', type);
  43.         this.querySelector('i').classList.toggle('fa-eye-slash');
  44.     });
  45. });
  46. </script>
  47. {% endblock %}