Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 259a2b7

Browse filesBrowse files
committed
bug #3866 [Book][Security]fixed Login when there is no session. (aitboudad)
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.
2 parents b32ec15 + a7b8bc4 commit 259a2b7
Copy full SHA for 259a2b7

File tree

Expand file treeCollapse file tree

1 file changed

+7
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-2
lines changed

‎book/security.rst

Copy file name to clipboardExpand all lines: book/security.rst
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,16 +449,21 @@ Next, create the controller that will display the login form::
449449
$error = $request->attributes->get(
450450
SecurityContextInterface::AUTHENTICATION_ERROR
451451
);
452-
} else {
452+
} elseif (null !== $session && $session->has(SecurityContextInterface::AUTHENTICATION_ERROR)) {
453453
$error = $session->get(SecurityContextInterface::AUTHENTICATION_ERROR);
454454
$session->remove(SecurityContextInterface::AUTHENTICATION_ERROR);
455+
} else {
456+
$error = '';
455457
}
458+
459+
// last username entered by the user
460+
$lastUsername = (null === $session) ? '' : $session->get(SecurityContextInterface::LAST_USERNAME);
456461

457462
return $this->render(
458463
'AcmeSecurityBundle:Security:login.html.twig',
459464
array(
460465
// last username entered by the user
461-
'last_username' => $session->get(SecurityContextInterface::LAST_USERNAME),
466+
'last_username' => $lastUsername,
462467
'error' => $error,
463468
)
464469
);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.