Permalink
Browse files

bug #3866 [Book][Security]fixed Login when there is no session. (aitb…

…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 259a2b7a891ba9c2f271cbcee5bf0130a15c98ac
Showing with 7 additions and 2 deletions.
  1. +7 −2 book/security.rst
@@ -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,
)
);

0 comments on commit 259a2b7

Please sign in to comment.