Skip to content

Commit 3969d7f

Browse files
committed
Merge pull request #1491 from aitboudad/patch-2
[SecurityContext] Use SecurityContextInterface.
2 parents 13c173f + 63e308c commit 3969d7f

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Controller/SecurityController.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
use Symfony\Component\DependencyInjection\ContainerAware;
1515
use Symfony\Component\HttpFoundation\Request;
16-
use Symfony\Component\Security\Core\SecurityContext;
16+
use Symfony\Component\Security\Core\SecurityContextInterface;
1717

1818
class SecurityController extends ContainerAware
1919
{
@@ -23,11 +23,11 @@ public function loginAction(Request $request)
2323
$session = $request->getSession();
2424

2525
// get the error if any (works with forward and redirect -- see below)
26-
if ($request->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) {
27-
$error = $request->attributes->get(SecurityContext::AUTHENTICATION_ERROR);
28-
} elseif (null !== $session && $session->has(SecurityContext::AUTHENTICATION_ERROR)) {
29-
$error = $session->get(SecurityContext::AUTHENTICATION_ERROR);
30-
$session->remove(SecurityContext::AUTHENTICATION_ERROR);
26+
if ($request->attributes->has(SecurityContextInterface::AUTHENTICATION_ERROR)) {
27+
$error = $request->attributes->get(SecurityContextInterface::AUTHENTICATION_ERROR);
28+
} elseif (null !== $session && $session->has(SecurityContextInterface::AUTHENTICATION_ERROR)) {
29+
$error = $session->get(SecurityContextInterface::AUTHENTICATION_ERROR);
30+
$session->remove(SecurityContextInterface::AUTHENTICATION_ERROR);
3131
} else {
3232
$error = '';
3333
}
@@ -37,7 +37,7 @@ public function loginAction(Request $request)
3737
$error = $error->getMessage();
3838
}
3939
// last username entered by the user
40-
$lastUsername = (null === $session) ? '' : $session->get(SecurityContext::LAST_USERNAME);
40+
$lastUsername = (null === $session) ? '' : $session->get(SecurityContextInterface::LAST_USERNAME);
4141

4242
$csrfToken = $this->container->has('form.csrf_provider')
4343
? $this->container->get('form.csrf_provider')->generateCsrfToken('authenticate')

0 commit comments

Comments
 (0)