Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. # config/packages/security.yaml
  2. security:
  3. # ...
  4.  
  5. firewalls:
  6. main:
  7. form_login:
  8. # ...
  9. default_target_path: after_login_route_name
  10.  
  11. public function afterloginRedirectAction(Request $request)
  12. {
  13.  
  14. if($this->get('security.authorization_checker')->isGranted('ROLE_ADMIN'))
  15. {
  16. return $this->redirectToRoute('admin_homepage');
  17. }
  18. else if($this->get('security.authorization_checker')->isGranted('ROLE_USER'))
  19. {
  20. return $this->redirectToRoute('user_homepage');
  21. }
  22. } ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement