File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
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 ;
15
16
use Symfony \Component \HttpFoundation \Request ;
16
17
use Symfony \Component \HttpFoundation \Response ;
17
18
use Symfony \Component \Routing \Annotation \Route ;
@@ -34,6 +35,11 @@ class SecurityController extends AbstractController
34
35
*/
35
36
public function login (Request $ request , AuthenticationUtils $ helper ): Response
36
37
{
38
+ // Block login page for logged in users
39
+ if ($ this ->container ->get ('security.authorization_checker ' )->isGranted ('ROLE_USER ' )) {
40
+ return $ this ->redirectToRoute ('blog_index ' );
41
+ }
42
+
37
43
// this statement solves an edge-case: if you change the locale in the login
38
44
// page, after a successful login you are redirected to a page in the previous
39
45
// locale. This code regenerates the referrer URL whenever the login page is
You can’t perform that action at this time.
0 commit comments