Skip to content

Commit

Permalink
Prevent producing an error if http-request is failing
Browse files Browse the repository at this point in the history
  • Loading branch information
tobihille authored Nov 1, 2018
1 parent f5c120c commit 20de029
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 20de029

Please sign in to comment.