mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-12-01 03:06:30 +00:00
Merge "HCaptcha: Inline variables and move closer to usages"
This commit is contained in:
commit
29c00e36e9
|
@ -126,18 +126,12 @@ class HCaptcha extends SimpleCaptcha {
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
protected function passCaptcha( $_, $token, $user ) {
|
protected function passCaptcha( $_, $token, $user ) {
|
||||||
$webRequest = RequestContext::getMain()->getRequest();
|
|
||||||
|
|
||||||
$secretKey = $this->hCaptchaConfig->get( 'HCaptchaSecretKey' );
|
|
||||||
$sendRemoteIp = $this->hCaptchaConfig->get( 'HCaptchaSendRemoteIP' );
|
|
||||||
$proxy = $this->hCaptchaConfig->get( 'HCaptchaProxy' );
|
|
||||||
|
|
||||||
$url = $this->hCaptchaConfig->get( 'HCaptchaVerifyUrl' );
|
|
||||||
$data = [
|
$data = [
|
||||||
'secret' => $secretKey,
|
'secret' => $this->hCaptchaConfig->get( 'HCaptchaSecretKey' ),
|
||||||
'response' => $token,
|
'response' => $token,
|
||||||
];
|
];
|
||||||
if ( $sendRemoteIp ) {
|
if ( $this->hCaptchaConfig->get( 'HCaptchaSendRemoteIP' ) ) {
|
||||||
|
$webRequest = RequestContext::getMain()->getRequest();
|
||||||
$data['remoteip'] = $webRequest->getIP();
|
$data['remoteip'] = $webRequest->getIP();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,12 +140,13 @@ class HCaptcha extends SimpleCaptcha {
|
||||||
'postData' => $data,
|
'postData' => $data,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$proxy = $this->hCaptchaConfig->get( 'HCaptchaProxy' );
|
||||||
if ( $proxy ) {
|
if ( $proxy ) {
|
||||||
$options['proxy'] = $proxy;
|
$options['proxy'] = $proxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
$request = MediaWikiServices::getInstance()->getHttpRequestFactory()
|
$request = MediaWikiServices::getInstance()->getHttpRequestFactory()
|
||||||
->create( $url, $options, __METHOD__ );
|
->create( $this->hCaptchaConfig->get( 'HCaptchaVerifyUrl' ), $options, __METHOD__ );
|
||||||
|
|
||||||
$status = $request->execute();
|
$status = $request->execute();
|
||||||
if ( !$status->isOK() ) {
|
if ( !$status->isOK() ) {
|
||||||
|
|
Loading…
Reference in a new issue