Skip to content
This repository has been archived by the owner on Nov 28, 2019. It is now read-only.

Commit

Permalink
Merge pull request #37 from Firesphere/patch-1
Browse files Browse the repository at this point in the history
Read out the entire request instead of postVars()
  • Loading branch information
chillu authored Oct 12, 2016
2 parents 80a6645 + c7c453b commit 9fdbfed
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions code/RecaptchaField.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,14 @@ public function Field($properties = array())
*/
public function validate($validator)
{
/** @var array $request */
/** @var array $postVars */
if(SapphireTest::is_running_test()) {
$request = $_REQUEST;
$postVars = $_REQUEST;
} else {
$request = Controller::curr()->getRequest();
$postVars = Controller::curr()->getRequest()->postVars();
}
// don't bother querying the recaptcha-service if fields were empty
if (!array_key_exists('g-recaptcha-response', $request) || empty($request['g-recaptcha-response'])) {
if (!array_key_exists('g-recaptcha-response', $postVars) || empty($postVars['g-recaptcha-response'])) {
$validator->validationError(
$this->name,
_t(
Expand All @@ -181,7 +181,7 @@ public function validate($validator)
return false;
}

$response = $this->recaptchaHTTPPost($_REQUEST['g-recaptcha-response']);
$response = $this->recaptchaHTTPPost($postVars['g-recaptcha-response']);

if (!$response) {
$validator->validationError(
Expand Down

0 comments on commit 9fdbfed

Please sign in to comment.