Skip to content

Commit

Permalink
feature #4761 [Cookbook][Security] don't output message from Authenti…
Browse files Browse the repository at this point in the history
…cationException (xabbuh)

This PR was merged into the 2.3 branch.

Discussion
----------

[Cookbook][Security] don't output message from AuthenticationException

| Q             | A
| ------------- | ---
| Doc fix?      | yes
| New docs?     | no
| Applies to    | all
| Fixed tickets |

Displaying the message of an `AuthenticationException` might expose
sensitive data to the user.

Commits
-------

44277c7 don't output message from AuthenticationException
  • Loading branch information
weaverryan committed Jan 16, 2015
2 parents 11c1047 + 44277c7 commit 9742b92
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cookbook/security/form_login_setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ First, enable form login under your firewall:
# app/config/security.yml
security:
# ...
firewalls:
default:
anonymous: ~
Expand Down Expand Up @@ -98,7 +98,7 @@ under your ``form_login`` configuration (``/login`` and ``/login_check``):
.. configuration-block::

.. code-block:: php-annotations
// src/AppBundle/Controller/SecurityController.php
// ...
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
Expand Down Expand Up @@ -165,7 +165,7 @@ form::

// src/AppBundle/Controller/SecurityController.php
// ...

// ADD THIS use STATEMENT above your class
use Symfony\Component\Security\Core\SecurityContextInterface;

Expand All @@ -182,7 +182,7 @@ form::
$error = $session->get(SecurityContextInterface::AUTHENTICATION_ERROR);
$session->remove(SecurityContextInterface::AUTHENTICATION_ERROR);
} else {
$error = '';
$error = null;
}

// last username entered by the user
Expand Down Expand Up @@ -218,7 +218,7 @@ Finally, create the template:
{# ... you will probably extends your base template, like base.html.twig #}

{% if error %}
<div>{{ error.message }}</div>
<div>{{ error.messageKey|trans(error.messageData) }}</div>
{% endif %}

<form action="{{ path('login_check') }}" method="post">
Expand Down

0 comments on commit 9742b92

Please sign in to comment.