Symfony2 - Access for Login and Register page for Anonymous only not Users

后端 未结 2 2080
名媛妹妹
名媛妹妹 2021-01-18 03:18

I have this website with a login form and after I successfully logged in, I am redirected to the index. But when I click the back button, it lets me still view the login for

2条回答
  •  迷失自我
    2021-01-18 03:40

    With symfony 4 you can solve it with allow_if :

    access_control:
    - { path: /login, allow_if: "!is_authenticated()" }
    

    here's the list of expressions available within allow_if string http://symfony.com/doc/current/security/expressions.html#security-expression-variables

提交回复
热议问题