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