This commit is only available in AjaxForm version 1.2.0 (and as far as I can tell this version was only released on modstore.pro
and not on modx.com
).
Also, the cache file is only used, when you don’t have sessions enabled for anonymous users.
But the use of a cache file seems to have another major drawback. If you make any change to your website (this change can be unrelated to the AjaxForm) during the time it takes for a (legitimate) user to fill out the form, this user won’t be able to send the form anymore. (So if you have a website that frequently changes with an AjaxForm that takes a long time to fill out, this might cause issues.)
The more I think about it, the less I see a good automatic solution to solve this issue. Because there can be multiple AjaxForms on your site (and even multiple AjaxForms on the same page), there is no way for AjaxForm to determine, which sets of properties are still valid (and which ones are outdated).
So it’s probably best to implement the solution from Павел (you linked above) and then update the value (both in the preHook-snippet and in action.php
) everytime you make a change (that is security related) to one of your AjaxForms.