0
votes

I have a simple search form on my layout, it sends data to the search controller wich displays the search results.

I implemented the security component on the search controller, it works fine if the request is from the controller itself (domain.com/searches) but it gets black-holed when the form is sumitted from any other controller.

This happens because the tokens are not inserted on the form unless I'm on the searches controller.

How can I activate security component across all controllers for the search form?

Thanks

2

2 Answers

0
votes

I found a solution that works, we can just add the component to the AppController.

I think it could be more accurate to add the component only to the search form, with the component on AppController we will get all the forms on the aplication secured and, for several reasons, you might not want/need that...

If anyone has a solution for the search form only it would be great!

0
votes

you can tell security component which other controller actions search controller can communicate with by whitelisting them

$this->Security->allowedActions = array(method1,method2);