fixes for missing recaptcha_check_answer() when validate is called by other extensions
authorKurund Jalmi <kurund.jalmi@gmail.com>
Thu, 18 Aug 2022 16:03:21 +0000 (17:03 +0100)
committerGitHub <noreply@github.com>
Thu, 18 Aug 2022 16:03:21 +0000 (17:03 +0100)
ext/recaptcha/CRM/Utils/ReCAPTCHA.php

index 33c78e174f9c9295332fe77dba7ec7ef8d61557d..85e483dd19c14494d054bb2f123b7e0a8ffa0d24 100644 (file)
@@ -202,6 +202,8 @@ class CRM_Utils_ReCAPTCHA {
    * @return mixed
    */
   public static function validate($value, $form) {
+    require_once E::path('lib/recaptcha/recaptchalib.php');
+
     $resp = recaptcha_check_answer(CRM_Core_Config::singleton()->recaptchaPrivateKey,
       $_SERVER['REMOTE_ADDR'],
       $_POST['g-recaptcha-response']