File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -449,16 +449,21 @@ Next, create the controller that will display the login form::
449
449
$error = $request->attributes->get(
450
450
SecurityContextInterface::AUTHENTICATION_ERROR
451
451
);
452
- } else {
452
+ } elseif (null !== $session && $session->has(SecurityContextInterface::AUTHENTICATION_ERROR)) {
453
453
$error = $session->get(SecurityContextInterface::AUTHENTICATION_ERROR);
454
454
$session->remove(SecurityContextInterface::AUTHENTICATION_ERROR);
455
+ } else {
456
+ $error = '';
455
457
}
458
+
459
+ // last username entered by the user
460
+ $lastUsername = (null === $session) ? '' : $session->get(SecurityContextInterface::LAST_USERNAME);
456
461
457
462
return $this->render(
458
463
'AcmeSecurityBundle:Security:login.html.twig',
459
464
array(
460
465
// last username entered by the user
461
- 'last_username' => $session->get(SecurityContextInterface::LAST_USERNAME) ,
466
+ 'last_username' => $lastUsername ,
462
467
'error' => $error,
463
468
)
464
469
);
You can’t perform that action at this time.
0 commit comments