(09-08-2021, 09:46 PM)manager Wrote: (09-08-2021, 07:56 PM)nneves Wrote: Hi
What's the best approach to use CSRF only in one page without using the Filter?
I need to remove all cookies for cache propose.
Thanks
You can add csrf fields in the view of that page and then in the controller check it manually.
But filters is convenient. If you want csrf just in one page you can use filters array inside app/config/filters.php config file.
PHP Code:
'csrf' => ['before' => ['myspecialpage/index']]
So this will apply only in one page.
Hi
Doing this way I have the csrf_cookie in all pages and that's somenthing I need to avoid.
I can get the field value from $this->request->getGetPost(csrf_token()) but how do I get the hash?
I have security.regenerate = false but when I receive the post data, csrf_hash() has a new value!
Thanks