Symfony2 is_granted('IS_AUTHENTICATED_FULLY') during 404 error page display, causing ResourceNotFoundException

前端 未结 3 1924
天命终不由人
天命终不由人 2020-12-29 07:09

I have setup custom error pages to display for certain HTTP errors in the folder:

app/Resources/TwigBundle/views/Exception/

The 403 page (<

3条回答
  •  梦谈多话
    2020-12-29 07:43

    I would suggest checking for app.security.token to be more strict and evaluate to true even when user is anonymous.

    If you check for app.user it will evaluate false in Exception templates, but even when the firewall is present (= regular templates) but the user is not logged. This will prevent - for example - the display of a login button.

    See: https://github.com/symfony/symfony-docs/pull/2359

提交回复
热议问题