@@ -683,7 +683,7 @@ First, create a controller for the login form:
683
683
684
684
class LoginController extends AbstractController
685
685
{
686
- #[Route('/login', name: 'login ')]
686
+ #[Route('/login', name: 'app_login ')]
687
687
public function index(): Response
688
688
{
689
689
return $this->render('login/index.html.twig', [
@@ -706,9 +706,9 @@ Then, enable the form login authenticator using the ``form_login`` setting:
706
706
main :
707
707
# ...
708
708
form_login :
709
- # "login " is the name of the route created previously
710
- login_path : login
711
- check_path : login
709
+ # "app_login " is the name of the route created previously
710
+ login_path : app_login
711
+ check_path : app_login
712
712
713
713
.. code-block :: xml
714
714
@@ -725,8 +725,8 @@ Then, enable the form login authenticator using the ``form_login`` setting:
725
725
<config >
726
726
<!-- ... -->
727
727
<firewall name =" main" >
728
- <!-- "login " is the name of the route created previously -->
729
- <form-login login-path =" login " check-path =" login " />
728
+ <!-- "app_login " is the name of the route created previously -->
729
+ <form-login login-path =" app_login " check-path =" app_login " />
730
730
</firewall >
731
731
</config >
732
732
</srv : container >
@@ -741,10 +741,10 @@ Then, enable the form login authenticator using the ``form_login`` setting:
741
741
742
742
$mainFirewall = $security->firewall('main');
743
743
744
- // "login " is the name of the route created previously
744
+ // "app_login " is the name of the route created previously
745
745
$mainFirewall->formLogin()
746
- ->loginPath('login ')
747
- ->checkPath('login ')
746
+ ->loginPath('app_login ')
747
+ ->checkPath('app_login ')
748
748
;
749
749
};
750
750
@@ -767,7 +767,7 @@ Edit the login controller to render the login form:
767
767
768
768
class LoginController extends AbstractController
769
769
{
770
- #[Route('/login', name: 'login ')]
770
+ #[Route('/login', name: 'app_login ')]
771
771
- public function index(): Response
772
772
+ public function index(AuthenticationUtils $authenticationUtils): Response
773
773
{
@@ -805,7 +805,7 @@ Finally, create or update the template:
805
805
<div>{{ error.messageKey|trans(error.messageData, 'security') }}</div>
806
806
{% endif %}
807
807
808
- <form action="{{ path('login ') }}" method="post">
808
+ <form action="{{ path('app_login ') }}" method="post">
809
809
<label for="username">Email:</label>
810
810
<input type="text" id="username" name="_username" value="{{ last_username }}"/>
811
811
@@ -829,7 +829,7 @@ Finally, create or update the template:
829
829
830
830
The form can look like anything, but it usually follows some conventions:
831
831
832
- * The ``<form> `` element sends a ``POST `` request to the ``login `` route, since
832
+ * The ``<form> `` element sends a ``POST `` request to the ``app_login `` route, since
833
833
that's what you configured as the ``check_path `` under the ``form_login `` key in
834
834
``security.yaml ``;
835
835
* The username (or whatever your user's "identifier" is, like an email) field has
@@ -942,7 +942,7 @@ be ``authenticate``:
942
942
{# templates/login/index.html.twig #}
943
943
944
944
{# ... #}
945
- <form action="{{ path('login ') }}" method="post">
945
+ <form action="{{ path('app_login ') }}" method="post">
946
946
{# ... the login fields #}
947
947
948
948
<input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}">
0 commit comments