Skip to content

Commit

Permalink
Merge pull request #3 from tobihille/master
Browse files Browse the repository at this point in the history
Prevent producing an error if http-request is failing
  • Loading branch information
noglitchyo authored Nov 1, 2018
2 parents f5c120c + 20de029 commit 3192959
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ public function validate()

try {
$data = $this->_request($captchaResponse, $secret);
if (empty($data)) {
return false;
}
} catch (Exception $e) {
return false;
}
Expand Down Expand Up @@ -68,10 +71,12 @@ protected function _request($captchaResponse, $secret)
catch (Zend_Http_Exception $e) {
Mage::logException($e);
Mage::getSingleton('customer/session')->addError(Mage::helper('grecaptcha')->__('Unable to validate the reCAPTCHA with Google. Please, retry later.'));
return null;
}
catch (Exception $e) {
Mage::logException($e);
Mage::getSingleton('customer/session')->addError(Mage::helper('grecaptcha')->__('Unable to validate the reCAPTCHA.'));
return null;
}

return $this->_parseResponse($response);
Expand Down

0 comments on commit 3192959

Please sign in to comment.