@@ -142,26 +142,26 @@ previously requested URL and always redirect to the default page:
142
142
Control the Redirect Using Request Parameters
143
143
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
144
144
145
- The URL to redirect after the login can be defined using the ``_target_path ``
146
- parameter of GET and POST requests . Its value must be a relative or absolute
145
+ The URL to redirect to after the login can be dynamically defined using the ``_target_path ``
146
+ parameter of the GET or POST request . Its value must be a relative or absolute
147
147
URL, not a Symfony route name.
148
148
149
- Defining the redirect URL via GET using a query string parameter:
149
+ For GET, use a query string parameter:
150
150
151
151
.. code-block :: text
152
152
153
153
http://example.com/some/path?_target_path=/dashboard
154
154
155
- Defining the redirect URL via POST using a hidden form field:
155
+ For POST, use a hidden form field:
156
156
157
157
.. code-block :: html+twig
158
158
159
- {# templates/security/ login.html.twig #}
160
- <form action="{{ path('login ') }}" method="post">
159
+ {# templates/login/index .html.twig #}
160
+ <form action="{{ path('app_login ') }}" method="post">
161
161
{# ... #}
162
162
163
- <input type="hidden" name="_target_path" value="{{ path('account') }}"/ >
164
- <input type="submit" name="login"/ >
163
+ <input type="hidden" name="_target_path" value="{{ path('account') }}">
164
+ <input type="submit" name="login">
165
165
</form>
166
166
167
167
Using the Referring URL
@@ -304,8 +304,8 @@ This option can also be set via the ``_failure_path`` request parameter:
304
304
<form action="{{ path('login') }}" method="post">
305
305
{# ... #}
306
306
307
- <input type="hidden" name="_failure_path" value="{{ path('forgot_password') }}"/ >
308
- <input type="submit" name="login"/ >
307
+ <input type="hidden" name="_failure_path" value="{{ path('forgot_password') }}">
308
+ <input type="submit" name="login">
309
309
</form>
310
310
311
311
Customizing the Target and Failure Request Parameters
@@ -383,7 +383,7 @@ are now fully customized:
383
383
<form action="{{ path('login') }}" method="post">
384
384
{# ... #}
385
385
386
- <input type="hidden" name="go_to" value="{{ path('dashboard') }}"/ >
387
- <input type="hidden" name="back_to" value="{{ path('forgot_password') }}"/ >
388
- <input type="submit" name="login"/ >
386
+ <input type="hidden" name="go_to" value="{{ path('dashboard') }}">
387
+ <input type="hidden" name="back_to" value="{{ path('forgot_password') }}">
388
+ <input type="submit" name="login">
389
389
</form>
0 commit comments