Skip to content

Commit e041365

Browse files
committed
Fix the retrieval of the last username when using forwarding
1 parent 5922d71 commit e041365

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Symfony/Component/Security/Http/Authentication/AuthenticationUtils.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,13 @@ public function getLastAuthenticationError($clearSession = true)
6565
*/
6666
public function getLastUsername()
6767
{
68-
$session = $this->getRequest()->getSession();
68+
$request = $this->getRequest();
69+
70+
if ($request->attributes->has(Security::LAST_USERNAME)) {
71+
return $request->attributes->get(Security::LAST_USERNAME);
72+
}
73+
74+
$session = $request->getSession();
6975

7076
return null === $session ? '' : $session->get(Security::LAST_USERNAME);
7177
}

0 commit comments

Comments
 (0)