8000 4668 document isCsrfTokenValid by snoek09 · Pull Request #5572 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

4668 document isCsrfTokenValid #5572

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

Closed
wants to merge 6 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
4668 link method to API docs, use 'was introduced' instead of 'was ad…
…ded'
  • Loading branch information
Henry Snoek committed Jul 28, 2015
commit b7d133f85d220b318e914212877a09cb3a0191d8
7 changes: 4 additions & 3 deletions book/controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ If you want to redirect the user to another page, use the ``redirectToRoute()``
}

.. versionadded:: 2.6
The ``redirectToRoute()`` method was added in Symfony 2.6. Previously (and still now), you
The ``redirectToRoute()`` method was introduced in Symfony 2.6. Previously (and still now), you
could use ``redirect()`` and ``generateUrl()`` together for this (see the example above).

Or, if you want to redirect externally, just use ``redirect()`` and pass it the URL::
Expand Down Expand Up @@ -809,14 +809,15 @@ Checking the Validity of a CSRF Token
Sometimes you want to use CSRF protection in an action where you don't want to use a
Symfony form.

If, for example, you're doing a DELETE action, you can use ``isCsrfTokenValid()``::
If, for example, you're doing a DELETE action, you can use the :method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller::isCsrfTokenValid`
method to check the CSRF token::

if ($this->isCsrfTokenValid('token_id', $submittedToken)) {
// ... do something, like deleting an object
}

.. versionadded:: 2.6
The ``isCsrfTokenValid()`` shortcut method was added in Symfony 2.6.
The ``isCsrfTokenValid()`` shortcut method was introduced in Symfony 2.6.

Previously you would use::

Expand Down
0