jan-vince/smallcontactform

Honey pot doesn't work (Antispam _protect field)

Closed this issue · 2 comments

Issue :

The component SmallContactForm.php can't verify the _protect field at line 327 :

    // Antispam validation if allowed
    if( Settings::getTranslated('add_antispam')) {
      $this->validationRules[('_protect-'.$this->alias)] = 'size:0';

There is also some others occurences of Input::get('_protect-'.$this->alias) in this SmallContactForm class.

But when we look at line 820, for anti spam field definition, we can see this :

      // Field attributes
      $attributes = [
        'id' => '_protect-'.$this->alias,
        'name' => '_protect',
        'class' => '_protect form-control',
        'value' => 'http://',
      ];

The name attribute therefore does not match and the field cannot be retrieved via POST data by the rest of the code.

Solution :

Replace attributes at line 820 by this instead :

      // Field attributes
      $attributes = [
        'id' => '_protect-'.$this->alias,
        'name' => '_protect-'.$this->alias,
        'class' => '_protect form-control',
        'value' => 'http://',
      ];

I have never seen this error, but you are right there should be correct name for the field.

Thanks!

You are welcome. That's a great plugin you have made.