File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 1212namespace App \Controller ;
1313
1414use Symfony \Bundle \FrameworkBundle \Controller \AbstractController ;
15- use Symfony \Component \HttpFoundation \RedirectResponse ;
1615use Symfony \Component \HttpFoundation \Request ;
1716use Symfony \Component \HttpFoundation \Response ;
1817use Symfony \Component \Routing \Annotation \Route ;
1918use Symfony \Component \Security \Http \Authentication \AuthenticationUtils ;
2019use Symfony \Component \Security \Http \Util \TargetPathTrait ;
20+ use Symfony \Component \Security \Core \Security ;
2121
2222/**
2323 * Controller used to manage the application security.
@@ -33,10 +33,10 @@ class SecurityController extends AbstractController
3333 /**
3434 * @Route("/login", name="security_login")
3535 */
36- public function login (Request $ request , AuthenticationUtils $ helper ): Response
36+ public function login (Request $ request , Security $ security , AuthenticationUtils $ helper ): Response
3737 {
38- // Block login page for logged in users
39- if ($ this -> container -> get ( ' security.authorization_checker ' ) ->isGranted ('ROLE_USER ' )) {
38+ // if user is already logged in, don't display the login page again
39+ if ($ security ->isGranted ('ROLE_USER ' )) {
4040 return $ this ->redirectToRoute ('blog_index ' );
4141 }
4242
You can’t perform that action at this time.
0 commit comments