Skip to content
This repository has been archived by the owner on Jan 12, 2022. It is now read-only.

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
himiklab committed May 12, 2019
1 parent 8e73cee commit 1a15b15
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/ReCaptchaBaseValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use Yii;
use yii\base\Exception;
use yii\httpclient\Client as HttpClient;
use yii\httpclient\Request as HttpClientRequest;
use yii\validators\Validator;

/**
Expand Down
7 changes: 6 additions & 1 deletion src/ReCaptchaValidator2.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ protected function validateValue($value)
} else {
$response = $this->getResponse($value);
if (!isset($response['success'], $response['hostname']) ||
($this->checkHostName && $response['hostname'] !== Yii::$app->request->hostName)
($this->checkHostName && $response['hostname'] !== $this->getHostName())
) {
throw new Exception('Invalid recaptcha verify response.');
}
Expand All @@ -104,4 +104,9 @@ protected function configComponentProcess()
}
}
}

protected function getHostName()
{
return Yii::$app->request->hostName;
}
}

0 comments on commit 1a15b15

Please sign in to comment.