So here's the thing, I created a symfony 4 app with 2 roles: ROLE_USER and ROLE_Admin with 2 pages: user page and Admin page. I'm totally new to symfony and the docs aren't helping. Now I want the login screen to direct each user to his respective page. I'm using the default security.yml and It's directing to the default home page. here's my security.yaml file:
security:
# https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
providers:
hamda:
entity:
class: App\Entity\User
property: username
encoders:
App\Entity\User: bcrypt
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
anonymous: true
provider: hamda
form_login:
login_path: login
check_path: login
default_target_path: /home
# Easy way to control access for large sections of your site
# Note: Only the *first* access control that matches will be used
access_control:
- { path: ^/admin, roles: ROLE_ADMIN }