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 1212namespace App \Controller ;
1313
1414use Symfony \Bundle \FrameworkBundle \Controller \AbstractController ;
15+ use Symfony \Component \HttpFoundation \RedirectResponse ;
1516use Symfony \Component \HttpFoundation \Request ;
1617use Symfony \Component \HttpFoundation \Response ;
1718use Symfony \Component \Routing \Annotation \Route ;
@@ -34,6 +35,11 @@ class SecurityController extends AbstractController
3435 */
3536 public function login (Request $ request , AuthenticationUtils $ helper ): Response
3637 {
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+
3743 // this statement solves an edge-case: if you change the locale in the login
3844 // page, after a successful login you are redirected to a page in the previous
3945 // locale. This code regenerates the referrer URL whenever the login page is
You can’t perform that action at this time.
0 commit comments