FriendlyCaptcha / friendly-captcha-wordpress

WordPress plugin for Friendly Captcha. Protect WordPress website forms from spam and abuse with Friendly Captcha, a privacy-first anti-bot solution.
https://friendlycaptcha.com
19 stars 9 forks source link

If Javascript has been deactivated, we wan't to flag it as spam (In Contact Form 7) #54

Closed helvete003 closed 1 year ago

helvete003 commented 2 years ago

Hello,

i know that this is not the most inclusive thing to do but i just had another customer who was confused why FC wouldn't just flag emails as spam when you have javascript deactivated and to be fair i was confused about that as well.

So the issue is, that the FC Server responses with a 401 Statuscode when you send an empty solution to it but in the CF7 Module everything that is not a 200 Statuscode will get a "success".

if ( 200 != $status ) {
    if ( WP_DEBUG ) {
              frcaptcha_log_remote_request( $endpoint, $request, $response );
              // error_log("The body was " . $body);
    }
          // Better safe than sorry, if the request is non-200 we can not verify the response
          // Either the user's credentials are wrong (e.g. wrong sitekey, api key) or the friendly
    // captcha servers are unresponsive.

    // TODO notify site admin somehow
    return array(
              "success" => true,
              "status" => $status,
              "errors" => array(),
              "response_body" => $response_body
          );
      }

It is also a bit confusing why there even was a verification of the solution when you already have checked that the solution is empty.

So i pretty much just return the $spam as true.

merlinfuchs commented 1 year ago

You are right that the check for emptiness of the solution currently doesn't have any effect beside logging. I'm not entirely sure how your change effects the response code tho. Without your change we are also returning $spam as true for an empty solution, just in a different place.

merlinfuchs commented 1 year ago

Ah I see, the frcaptcha_verify_captcha_solution just assumes 401 status codes to be a misconfiguration of the plugin. Thanks for the PR and sorry for the delay 👍