smallcontactform icon indicating copy to clipboard operation
smallcontactform copied to clipboard

Disable Plain HTTP POST request to prevent spam.

Open TimFoerster opened this issue 3 years ago • 1 comments

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();
    }
    
    ...
  }  

TimFoerster avatar Jun 18 '21 20:06 TimFoerster

Hi @TimFoerster, this would need an extra option in plugin's settings to disable POST requests.

I will add this to my todo list!

jan-vince avatar Jun 21 '21 09:06 jan-vince

Hi @TimFoerster and sorry for the delay.

I have added this in 1.63.0.

jan-vince avatar Mar 23 '23 07:03 jan-vince