@@ -655,7 +655,7 @@ First, create a controller for the login form:
655
655
656
656
class LoginController extends AbstractController
657
657
{
658
- #[Route('/login', name: 'login ')]
658
+ #[Route('/login', name: 'app_login ')]
659
659
public function index(): Response
660
660
{
661
661
return $this->render('login/index.html.twig', [
@@ -678,9 +678,9 @@ Then, enable the form login authenticator using the ``form_login`` setting:
678
678
main :
679
679
# ...
680
680
form_login :
681
- # "login " is the name of the route created previously
682
- login_path : login
683
- check_path : login
681
+ # "app_login " is the name of the route created previously
682
+ login_path : app_login
683
+ check_path : app_login
684
684
685
685
.. code-block :: xml
686
686
@@ -697,8 +697,8 @@ Then, enable the form login authenticator using the ``form_login`` setting:
697
697
<config >
698
698
<!-- ... -->
699
699
<firewall name =" main" >
700
- <!-- "login " is the name of the route created previously -->
701
- <form-login login-path =" login " check-path =" login " />
700
+ <!-- "app_login " is the name of the route created previously -->
701
+ <form-login login-path =" app_login " check-path =" app_login " />
702
702
</firewall >
703
703
</config >
704
704
</srv : container >
@@ -713,10 +713,10 @@ Then, enable the form login authenticator using the ``form_login`` setting:
713
713
714
714
$mainFirewall = $security->firewall('main');
715
715
716
- // "login " is the name of the route created previously
716
+ // "app_login " is the name of the route created previously
717
717
$mainFirewall->formLogin()
718
- ->loginPath('login ')
719
- ->checkPath('login ')
718
+ ->loginPath('app_login ')
719
+ ->checkPath('app_login ')
720
720
;
721
721
};
722
722
@@ -739,7 +739,7 @@ Edit the login controller to render the login form:
739
739
740
740
class LoginController extends AbstractController
741
741
{
742
- #[Route('/login', name: 'login ')]
742
+ #[Route('/login', name: 'app_login ')]
743
743
- public function index(): Response
744
744
+ public function index(AuthenticationUtils $authenticationUtils): Response
745
745
{
@@ -777,7 +777,7 @@ Finally, create or update the template:
777
777
<div>{{ error.messageKey|trans(error.messageData, 'security') }}</div>
778
778
{% endif %}
779
779
780
- <form action="{{ path('login ') }}" method="post">
780
+ <form action="{{ path('app_login ') }}" method="post">
781
781
<label for="username">Email:</label>
782
782
<input type="text" id="username" name="_username" value="{{ last_username }}"/>
783
783
@@ -801,7 +801,7 @@ Finally, create or update the template:
801
801
802
802
The form can look like anything, but it usually follows some conventions:
803
803
804
- * The ``<form> `` element sends a ``POST `` request to the ``login `` route, since
804
+ * The ``<form> `` element sends a ``POST `` request to the ``app_login `` route, since
805
805
that's what you configured as the ``check_path `` under the ``form_login `` key in
806
806
``security.yaml ``;
807
807
* The username (or whatever your user's "identifier" is, like an email) field has
@@ -914,7 +914,7 @@ be ``authenticate``:
914
914
{# templates/login/index.html.twig #}
915
915
916
916
{# ... #}
917
- <form action="{{ path('login ') }}" method="post">
917
+ <form action="{{ path('app_login ') }}" method="post">
918
918
{# ... the login fields #}
919
919
920
920
<input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}">
0 commit comments