Disable filter in specific module / action in symfony

I have a filter that queries the DB to check if the username matches the password. If it returns false, the filter is redirected to the "logout" action. The only problem is that it will go into an infinite loop, because the filter applies to the logout action.

Is it possible to disable the filter only for this action?

+4
source share
1 answer

You will need to perform a check inside the filter. You can get the current module and action from $ this-> context-> getModuleName () and $ this-> context-> getActionName (). Or you can check the current route name, $ this-> context-> getRouting () → getCurrentRouteName ().

In fact, sfBasicSecurityFilter does the same, disabling forwarding for the login action. Look at the code for it.

+7
source

Source: https://habr.com/ru/post/1369363/


All Articles