Skip to content

Commit

Permalink
bug #3866 [Book][Security]fixed Login when there is no session. (aitb…
Browse files Browse the repository at this point in the history
…oudad)

This PR was merged into the 2.3 branch.

Discussion
----------

[Book][Security]fixed Login when there is no session.

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

Commits
-------

a7b8bc4 [Security]fixed Login when there is no session.
  • Loading branch information
weaverryan committed May 29, 2014
2 parents b32ec15 + a7b8bc4 commit 259a2b7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions book/security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -449,16 +449,21 @@ Next, create the controller that will display the login form::
$error = $request->attributes->get(
SecurityContextInterface::AUTHENTICATION_ERROR
);
} else {
} elseif (null !== $session && $session->has(SecurityContextInterface::AUTHENTICATION_ERROR)) {
$error = $session->get(SecurityContextInterface::AUTHENTICATION_ERROR);
$session->remove(SecurityContextInterface::AUTHENTICATION_ERROR);
} else {
$error = '';
}
// last username entered by the user
$lastUsername = (null === $session) ? '' : $session->get(SecurityContextInterface::LAST_USERNAME);

return $this->render(
'AcmeSecurityBundle:Security:login.html.twig',
array(
// last username entered by the user
'last_username' => $session->get(SecurityContextInterface::LAST_USERNAME),
'last_username' => $lastUsername,
'error' => $error,
)
);
Expand Down

0 comments on commit 259a2b7

Please sign in to comment.