Skip to content
Permalink
Browse files

Consistently using SecurityContextInterface (I had a mix before)

  • Loading branch information
weaverryan committed Nov 22, 2014
1 parent 13766be commit 039d5474d42288283b8cbfe2ad0376056f97f706
Showing with 6 additions and 6 deletions.
  1. +6 −6 knpu/episode2/login-form.rst
@@ -135,7 +135,7 @@ classes::

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\Security\Core\SecurityContext;
use Symfony\Component\Security\Core\SecurityContextInterface;
use Symfony\Component\HttpFoundation\Request;
// ...

@@ -149,20 +149,20 @@ classes::
$session = $request->getSession();

// get the login error if there is one
if ($request->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) {
if ($request->attributes->has(SecurityContextInterface::AUTHENTICATION_ERROR)) {
$error = $request->attributes->get(
SecurityContext::AUTHENTICATION_ERROR
SecurityContextInterface::AUTHENTICATION_ERROR
);
} else {
$error = $session->get(SecurityContext::AUTHENTICATION_ERROR);
$session->remove(SecurityContext::AUTHENTICATION_ERROR);
$error = $session->get(SecurityContextInterface::AUTHENTICATION_ERROR);
$session->remove(SecurityContextInterface::AUTHENTICATION_ERROR);
}

return $this->render(
'AcmeSecurityBundle:Security:login.html.twig',
array(
// last username entered by the user
'last_username' => $session->get(SecurityContext::LAST_USERNAME),
'last_username' => $session->get(SecurityContextInterface::LAST_USERNAME),
'error' => $error,
)
);

0 comments on commit 039d547

Please sign in to comment.
You can’t perform that action at this time.