smallcontactform
smallcontactform copied to clipboard
Disable Plain HTTP POST request to prevent spam.
IMHO the most useful Anti-Spam filter is to ignore plain POST requests and only allow AJAX requests.
I have over 10 sites with that filter and never get any spam mail.
I used a little trick before to disable contact requests, by redirecting the plain request to the index site.
{% set attributes = __SELF__.getFormAttributes|merge({'url': '/'}) %}
{{ form_ajax('contactForm::onFormSend', attributes) }}
Would be great to support that out of the box. Idea
public function onFormSend(){
if ($this->ajaxOnly && !Request::ajax()) {
return Redirect::refresh();
}
...
}
Hi @TimFoerster, this would need an extra option in plugin's settings to disable POST requests.
I will add this to my todo list!
Hi @TimFoerster and sorry for the delay.
I have added this in 1.63.0.