فهرست منبع

Authenticate propre

François Drouhard 1 سال پیش
والد
کامیت
e4dff03da7
2فایلهای تغییر یافته به همراه7 افزوده شده و 3 حذف شده
  1. 5 1
      config/packages/security.yaml
  2. 2 2
      templates/security/login.html.twig

+ 5 - 1
config/packages/security.yaml

@@ -32,10 +32,14 @@ security:
             remember_me:
                 secret: '%kernel.secret%'
                 samesite: 'lax'
+            form_login:
+                login_path: app_login
+                check_path: app_login
+                enable_csrf: true
             logout:
                 path: app_logout
                 target: app_login
-            custom_authenticator: App\Security\LoginFormAuthenticator
+            #custom_authenticator: App\Security\LoginFormAuthenticator
             #lazy: true
             #provider: users_in_memory
 

+ 2 - 2
templates/security/login.html.twig

@@ -12,11 +12,11 @@
                     {% endif %}
                     <label for="inputUsername" class="sr-only">Login</label>
                     <div class="input-group mb-3">
-                        <input type="text" value="{{ last_username }}" name="username" id="inputUsername" class="form-control" placeholder="Login" required autofocus>
+                        <input type="text" value="{{ last_username }}" name="_username" id="inputUsername" class="form-control" placeholder="Login" required autofocus>
                     </div>
                     <label for="inputPassword" class="sr-only">Mot de passe</label>
                     <div class="input-group mb-3">
-                        <input type="password" name="password" id="inputPassword" class="form-control" placeholder="Mot de passe" required>
+                        <input type="password" name="_password" id="inputPassword" class="form-control" placeholder="Mot de passe" required>
                     </div>
                     <input type="hidden" name="_csrf_token"
                         value="{{ csrf_token('authenticate') }}"