Browse Source

Remember me

Sangfroid 2 months ago
parent
commit
7a4d1128c1
2 changed files with 13 additions and 11 deletions
  1. 7 0
      config/packages/security.yaml
  2. 6 11
      templates/security/login.html.twig

+ 7 - 0
config/packages/security.yaml

@@ -24,6 +24,13 @@ security:
                 path: app_logout
                 path: app_logout
                 # where to redirect after logout
                 # where to redirect after logout
                 # target: app_any_route
                 # target: app_any_route
+            remember_me:
+                secret:   '%kernel.secret%' # required
+                #lifetime: 604800 # 1 week in seconds
+                # by default, the feature is enabled by checking a
+                # checkbox in the login form (see below), uncomment the
+                # following line to always enable it.
+                #always_remember_me: true
 
 
             # activate different ways to authenticate
             # activate different ways to authenticate
             # https://symfony.com/doc/current/security.html#the-firewall
             # https://symfony.com/doc/current/security.html#the-firewall

+ 6 - 11
templates/security/login.html.twig

@@ -1,6 +1,6 @@
 {% extends 'base.html.twig' %}
 {% extends 'base.html.twig' %}
 
 
-{% block title %}Log in!{% endblock %}
+{% block title %}Se connecter{% endblock %}
 
 
 {% block body %}
 {% block body %}
     <form method="post">
     <form method="post">
@@ -10,29 +10,24 @@
 
 
         {% if app.user %}
         {% if app.user %}
             <div class="mb-3">
             <div class="mb-3">
-                You are logged in as {{ app.user.userIdentifier }}, <a href="{{ path('app_logout') }}">Logout</a>
+                Vous êtes connecté en tant que {{ app.user.userIdentifier }}, <a href="{{ path('app_logout') }}">Logout</a>
             </div>
             </div>
         {% endif %}
         {% endif %}
 
 
-        <h1 class="h3 mb-3 font-weight-normal">Please sign in</h1>
-        <label for="username">Username</label>
+        <h1 class="h3 mb-3 font-weight-normal">Se connecter</h1>
+        <label for="username">Nom d'utilisateur</label>
         <input type="text" value="{{ last_username }}" name="_username" id="username" class="form-control" autocomplete="username" required autofocus>
         <input type="text" value="{{ last_username }}" name="_username" id="username" class="form-control" autocomplete="username" required autofocus>
-        <label for="password">Password</label>
+        <label for="password">Mot de passe</label>
         <input type="password" name="_password" id="password" class="form-control" autocomplete="current-password" required>
         <input type="password" name="_password" id="password" class="form-control" autocomplete="current-password" required>
 
 
         <input type="hidden" name="_csrf_token"
         <input type="hidden" name="_csrf_token"
                value="{{ csrf_token('authenticate') }}"
                value="{{ csrf_token('authenticate') }}"
         >
         >
 
 
-        {#
-            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">
             <div class="checkbox mb-3">
                 <input type="checkbox" name="_remember_me" id="_remember_me">
                 <input type="checkbox" name="_remember_me" id="_remember_me">
-                <label for="_remember_me">Remember me</label>
+                <label for="_remember_me">Se souvenir de moi</label>
             </div>
             </div>
-        #}
 
 
         <button class="btn btn-lg btn-blue" type="submit">
         <button class="btn btn-lg btn-blue" type="submit">
             Sign in
             Sign in