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 12
12
namespace App \Controller ;
13
13
14
14
use Symfony \Bundle \FrameworkBundle \Controller \AbstractController ;
15
- use Symfony \Component \HttpFoundation \RedirectResponse ;
16
15
use Symfony \Component \HttpFoundation \Request ;
17
16
use Symfony \Component \HttpFoundation \Response ;
18
17
use Symfony \Component \Routing \Annotation \Route ;
19
18
use Symfony \Component \Security \Http \Authentication \AuthenticationUtils ;
20
19
use Symfony \Component \Security \Http \Util \TargetPathTrait ;
20
+ use Symfony \Component \Security \Core \Security ;
21
21
22
22
/**
23
23
* Controller used to manage the application security.
@@ -33,10 +33,10 @@ class SecurityController extends AbstractController
33
33
/**
34
34
* @Route("/login", name="security_login")
35
35
*/
36
- public function login (Request $ request , AuthenticationUtils $ helper ): Response
36
+ public function login (Request $ request , Security $ security , AuthenticationUtils $ helper ): Response
37
37
{
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 ' )) {
40
40
return $ this ->redirectToRoute ('blog_index ' );
41
41
}
42
42
You can’t perform that action at this time.
0 commit comments