Skip to content

Commit 80d70a4

Browse files
committed
bug symfony#3779 [Book][Security] constants are defined in the SecurityContextInterface (xabbuh)
This PR was merged into the 2.3 branch. Discussion ---------- [Book][Security] constants are defined in the SecurityContextInterface | Q | A | ------------- | --- | Doc fix? | yes | New docs? | no | Applies to | all | Fixed tickets | Commits ------- 4b7c8c2 [Book][Security] constants are defined in the SecurityContextInterface
2 parents f665e14 + 4b7c8c2 commit 80d70a4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

book/security.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ Next, create the controller that will display the login form::
436436

437437
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
438438
use Symfony\Component\HttpFoundation\Request;
439-
use Symfony\Component\Security\Core\SecurityContext;
439+
use Symfony\Component\Security\Core\SecurityContextInterface;
440440

441441
class SecurityController extends Controller
442442
{
@@ -445,20 +445,20 @@ Next, create the controller that will display the login form::
445445
$session = $request->getSession();
446446

447447
// get the login error if there is one
448-
if ($request->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) {
448+
if ($request->attributes->has(SecurityContextInterface::AUTHENTICATION_ERROR)) {
449449
$error = $request->attributes->get(
450-
SecurityContext::AUTHENTICATION_ERROR
450+
SecurityContextInterface::AUTHENTICATION_ERROR
451451
);
452452
} else {
453-
$error = $session->get(SecurityContext::AUTHENTICATION_ERROR);
454-
$session->remove(SecurityContext::AUTHENTICATION_ERROR);
453+
$error = $session->get(SecurityContextInterface::AUTHENTICATION_ERROR);
454+
$session->remove(SecurityContextInterface::AUTHENTICATION_ERROR);
455455
}
456456

457457
return $this->render(
458458
'AcmeSecurityBundle:Security:login.html.twig',
459459
array(
460460
// last username entered by the user
461-
'last_username' => $session->get(SecurityContext::LAST_USERNAME),
461+
'last_username' => $session->get(SecurityContextInterface::LAST_USERNAME),
462462
'error' => $error,
463463
)
464464
);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy