What is the best way to notify a user after an access_control rule redirects?

前端 未结 3 1101
庸人自扰
庸人自扰 2020-11-30 01:32

From Symfony 2.3 Security docs:

If access is denied, the system will try to authenticate the user if not already (e.g. redirect the user to th

3条回答
  •  醉酒成梦
    2020-11-30 01:56

    Could you not just have two login routes?

    For example, in security config set

    form_login:
        login_path: /login_message
    

    In your login controller

    /**
     * @Template()
     * @Route("/notauthorized", name="login_message")
     */
     public function loginMessageAction()
     {
        return [];
     }
    

    And then in your loginMessage.html.twg

    You must login to access this page.
    

提交回复
热议问题