diff --git a/composer.json b/composer.json index 288648673379c4667fcd0f686e1d3d0b30b13ea6..68d2a74872b3dd8798d38e0e4757190efaa181e0 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "aferrandini/phpqrcode": "1.0.1", "jasig/phpcas": "1.3.3", "cap60552/php-sip2": "1.0.0", - "los/losrecaptcha": "1.0.0", + "los/losrecaptcha": "2.0.2", "ahand/mobileesp": "dev-master", "matthiasmullie/minify": "1.3.35", "ocramius/proxy-manager": "1.0.2", diff --git a/module/VuFind/src/VuFind/Controller/Plugin/Recaptcha.php b/module/VuFind/src/VuFind/Controller/Plugin/Recaptcha.php index b5c15efc686cda999b797b41efb20a8f8a77ec37..8426b33d0a6943850726d9a74372325a38f3feb3 100644 --- a/module/VuFind/src/VuFind/Controller/Plugin/Recaptcha.php +++ b/module/VuFind/src/VuFind/Controller/Plugin/Recaptcha.php @@ -124,7 +124,7 @@ class Recaptcha extends AbstractPlugin } catch (\ZendService\ReCaptcha\Exception $e) { $response = false; } - $captchaPassed = $response && $response->isValid(); + $captchaPassed = $response && $response->isSuccess(); if (!$captchaPassed && $this->errorMode != 'none') { if ($this->errorMode == 'flash') { $this->getController()->flashMessenger() diff --git a/module/VuFind/src/VuFind/Service/Factory.php b/module/VuFind/src/VuFind/Service/Factory.php index 0118867d1f10f369eaf56c233686289b14423dc5..7be34956db48460b2f7a47d0ccd932cb2f3bad49 100644 --- a/module/VuFind/src/VuFind/Service/Factory.php +++ b/module/VuFind/src/VuFind/Service/Factory.php @@ -540,17 +540,18 @@ class Factory : (isset($config->Captcha->privateKey) ? $config->Captcha->privateKey : ''); - $recaptcha = new \VuFind\Service\ReCaptcha( - $siteKey, $secretKey, ['ssl' => true] - ); + $httpClient = $sm->get('VuFind\Http')->createClient(); + $translator = $sm->get('VuFind\Translator'); + $options = ['lang' => $translator->getLocale()]; if (isset($config->Captcha->theme)) { - $recaptcha->setOption('theme', $config->Captcha->theme); + $options['theme'] = $config->Captcha->theme; } - $translator = $sm->get('VuFind\Translator'); - $recaptcha->setOption('lang', $translator->getLocale()); + $recaptcha = new \VuFind\Service\ReCaptcha( + $siteKey, $secretKey, + new \LosReCaptcha\Service\Request\ZendHttpClient($httpClient), + ['ssl' => true], $options + ); - $httpClient = $sm->get('VuFind\Http')->createClient(); - $recaptcha->setHttpClient($httpClient); return $recaptcha; } diff --git a/module/VuFind/src/VuFind/Service/ReCaptcha.php b/module/VuFind/src/VuFind/Service/ReCaptcha.php index a815277943660547242443a439c253199dd93c8d..e693289803e1fd22826c6a1897087642a2af8257 100644 --- a/module/VuFind/src/VuFind/Service/ReCaptcha.php +++ b/module/VuFind/src/VuFind/Service/ReCaptcha.php @@ -20,7 +20,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category VuFind - * @package View_Helpers + * @package Service * @author Chris Hallberg <crhallberg@gmail.com> * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License * @link https://vufind.org/wiki/development Wiki