Skip to content

[Security] Minor rewording #17427

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -768,13 +768,13 @@ Finally, create or update the template:

<form action="{{ path('app_login') }}" method="post">
<label for="username">Email:</label>
<input type="text" id="username" name="_username" value="{{ last_username }}"/>
<input type="text" id="username" name="_username" value="{{ last_username }}">

<label for="password">Password:</label>
<input type="password" id="password" name="_password"/>
<input type="password" id="password" name="_password">

{# If you want to control the URL the user is redirected to on success
<input type="hidden" name="_target_path" value="/account"/> #}
<input type="hidden" name="_target_path" value="/account"> #}

<button type="submit">login</button>
</form>
Expand Down
26 changes: 13 additions & 13 deletions security/form_login.rst
Original file line number Diff line number Diff line change
Expand Up @@ -142,26 +142,26 @@ previously requested URL and always redirect to the default page:
Control the Redirect Using Request Parameters
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The URL to redirect after the login can be defined using the ``_target_path``
parameter of GET and POST requests. Its value must be a relative or absolute
The URL to redirect to after the login can be dynamically defined using the ``_target_path``
parameter of the GET or POST request. Its value must be a relative or absolute
URL, not a Symfony route name.

Defining the redirect URL via GET using a query string parameter:
For GET, use a query string parameter:

.. code-block:: text

http://example.com/some/path?_target_path=/dashboard

Defining the redirect URL via POST using a hidden form field:
For POST, use a hidden form field:

.. code-block:: html+twig

{# templates/security/login.html.twig #}
<form action="{{ path('login') }}" method="post">
{# templates/login/index.html.twig #}
<form action="{{ path('app_login') }}" method="post">
{# ... #}

<input type="hidden" name="_target_path" value="{{ path('account') }}"/>
<input type="submit" name="login"/>
<input type="hidden" name="_target_path" value="{{ path('account') }}">
<input type="submit" name="login">
</form>

Using the Referring URL
Expand Down Expand Up @@ -304,8 +304,8 @@ This option can also be set via the ``_failure_path`` request parameter:
<form action="{{ path('login') }}" method="post">
{# ... #}

<input type="hidden" name="_failure_path" value="{{ path('forgot_password') }}"/>
<input type="submit" name="login"/>
<input type="hidden" name="_failure_path" value="{{ path('forgot_password') }}">
<input type="submit" name="login">
</form>

Customizing the Target and Failure Request Parameters
Expand Down Expand Up @@ -383,7 +383,7 @@ are now fully customized:
<form action="{{ path('login') }}" method="post">
{# ... #}

<input type="hidden" name="go_to" value="{{ path('dashboard') }}"/>
<input type="hidden" name="back_to" value="{{ path('forgot_password') }}"/>
<input type="submit" name="login"/>
<input type="hidden" name="go_to" value="{{ path('dashboard') }}">
<input type="hidden" name="back_to" value="{{ path('forgot_password') }}">
<input type="submit" name="login">
</form>