w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to restrict acces to login form if user is authenticated?

You need to use firewall
Example of firewall:

firewalls:
         main:
            pattern: ^/
            form_login:
                check_path: /
                login_path: /
                always_use_default_target_path: true
                default_target_path: /main
            logout:
                path: /logout
                target : /
            anonymous: true
            security: true

    access_control:
        - { path: ^/main, roles: ["ROLE_USER","ROLE_ADMIN"] }
        - { path: ^/admin, roles: ["ROLE_ADMIN"] }

http://symfony.com/doc/current/components/security/firewall.html





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.