Fix the retrieval of the last username when using forwarding

This commit is contained in:
Christophe Coevoet 2016-07-11 11:55:50 +02:00
parent 5922d715d8
commit e04136524c
1 changed files with 7 additions and 1 deletions

View File

@ -65,7 +65,13 @@ class AuthenticationUtils
*/
public function getLastUsername()
{
$session = $this->getRequest()->getSession();
$request = $this->getRequest();
if ($request->attributes->has(Security::LAST_USERNAME)) {
return $request->attributes->get(Security::LAST_USERNAME);
}
$session = $request->getSession();
return null === $session ? '' : $session->get(Security::LAST_USERNAME);
}