Skip to content

Commit

Permalink
Post params updated to v2.
Browse files Browse the repository at this point in the history
  • Loading branch information
Caffe1neAdd1ct committed May 8, 2018
1 parent 6278f75 commit 125189e
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions inc/Zend/Service/ReCaptcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,10 +391,6 @@ public function getHtml($name = null)

$host = self::API_SERVER;

if ((bool) $this->_params['ssl'] === true) {
$host = self::API_SECURE_SERVER;
}

$paramsEncoded = '';

if (!empty($this->_options)) {
Expand All @@ -409,7 +405,7 @@ public function getHtml($name = null)
}

$script = <<<SCRIPT
<script src="https://www.google.com/recaptcha/api.js?{$paramsEncoded}" async defer></script>
<script src="{$host}.js?{$paramsEncoded}" async defer></script>
SCRIPT;


Expand All @@ -428,7 +424,7 @@ public function getHtml($name = null)
* @return Zend_Http_Response
* @throws Zend_Service_ReCaptcha_Exception
*/
protected function _post($challengeField, $responseField)
protected function _post($responseField)
{
if ($this->_privateKey === null) {
/** @see Zend_Service_ReCaptcha_Exception */
Expand All @@ -448,10 +444,11 @@ protected function _post($challengeField, $responseField)
$httpClient = self::getHttpClient();
$httpClient->resetParameters(true);

$postParams = array('privatekey' => $this->_privateKey,
'remoteip' => $this->_ip,
'challenge' => $challengeField,
'response' => $responseField);
$postParams = array(
'secret' => $this->_privateKey,
'remoteip' => $this->_ip,
'response' => $responseField
);

/* Make the POST and return the response */
return $httpClient->setUri(self::VERIFY_SERVER)
Expand All @@ -469,9 +466,9 @@ protected function _post($challengeField, $responseField)
* @param string $responseField
* @return Zend_Service_ReCaptcha_Response
*/
public function verify($challengeField, $responseField)
public function verify($responseField)
{
$response = $this->_post($challengeField, $responseField);
$response = $this->_post($responseField);

return new Zend_Service_ReCaptcha_Response(null, null, $response);
}
Expand Down

0 comments on commit 125189e

Please sign in to comment.