Skip to content

Commit 6d1dd27

Browse files
committed
Fixed an error in code examples for _target_path in the login form
1 parent 55da9ac commit 6d1dd27

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

cookbook/security/form_login.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ redirect to the URL defined by some ``acount`` route, use the following:
261261
<label for="password">Password:</label>
262262
<input type="password" id="password" name="_password" />
263263

264-
<input type="hidden" name="_target_path" value="{{ path('account') }}" />
264+
<input type="hidden" name="_target_path" value="account" />
265265

266266
<input type="submit" name="login" />
267267
</form>
@@ -280,13 +280,14 @@ redirect to the URL defined by some ``acount`` route, use the following:
280280
<label for="password">Password:</label>
281281
<input type="password" id="password" name="_password" />
282282

283-
<input type="hidden" name="_target_path" value="<?php echo $view['router']->generate('account') ?>" />
283+
<input type="hidden" name="_target_path" value="account" />
284284

285285
<input type="submit" name="login" />
286286
</form>
287287

288-
Now, the user will be redirected to the value of the hidden form field. You
289-
can even change the name of the hidden form field by changing the ``target_path_parameter``
288+
Now, the user will be redirected to the value of the hidden form field. The
289+
value attribute can be a relative path, absolute URL, or a route name. You
290+
can even change the name of the hidden form field by changing the ``target_path_parameter``
290291
option to another value.
291292

292293
.. configuration-block::

0 commit comments

Comments
 (0)