mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-11-24 08:13:53 +00:00
Merge "Update API parameter injection"
This commit is contained in:
commit
b99e833d91
27
Captcha.php
27
Captcha.php
|
@ -577,15 +577,23 @@ class SimpleCaptcha {
|
|||
|
||||
/**
|
||||
* @param $module ApiBase
|
||||
* @param $params array
|
||||
* @return bool
|
||||
*/
|
||||
public function APIGetAllowedParams( &$module, &$params ) {
|
||||
if ( !$module instanceof ApiEditPage ) {
|
||||
return true;
|
||||
protected function isAPICaptchaModule( $module ) {
|
||||
return $module instanceof ApiEditPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $module ApiBase
|
||||
* @param $params array
|
||||
* @param $flags int
|
||||
* @return bool
|
||||
*/
|
||||
public function APIGetAllowedParams( &$module, &$params, $flags ) {
|
||||
if ( $flags && $this->isAPICaptchaModule( $module ) ) {
|
||||
$params['captchaword'] = null;
|
||||
$params['captchaid'] = null;
|
||||
}
|
||||
$params['captchaword'] = null;
|
||||
$params['captchaid'] = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -596,11 +604,10 @@ class SimpleCaptcha {
|
|||
* @return bool
|
||||
*/
|
||||
public function APIGetParamDescription( &$module, &$desc ) {
|
||||
if ( !$module instanceof ApiEditPage ) {
|
||||
return true;
|
||||
if ( $this->isAPICaptchaModule( $module ) ) {
|
||||
$desc['captchaid'] = 'CAPTCHA ID from previous request';
|
||||
$desc['captchaword'] = 'Answer to the CAPTCHA';
|
||||
}
|
||||
$desc['captchaid'] = 'CAPTCHA ID from previous request';
|
||||
$desc['captchaword'] = 'Answer to the CAPTCHA';
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -55,8 +55,9 @@ class ConfirmEditHooks {
|
|||
return self::getInstance()->confirmEmailUser( $from, $to, $subject, $text, $error );
|
||||
}
|
||||
|
||||
public static function APIGetAllowedParams( &$module, &$params ) {
|
||||
return self::getInstance()->APIGetAllowedParams( $module, $params );
|
||||
// Default $flags to 1 for backwards-compatible behavior
|
||||
public static function APIGetAllowedParams( &$module, &$params, $flags = 1 ) {
|
||||
return self::getInstance()->APIGetAllowedParams( $module, $params, $flags );
|
||||
}
|
||||
|
||||
public static function APIGetParamDescription( &$module, &$desc ) {
|
||||
|
|
|
@ -81,11 +81,21 @@ class ReCaptcha extends SimpleCaptcha {
|
|||
return wfMessage( $name, $text )->isDisabled() ? wfMessage( 'recaptcha-edit' )->text() : $text;
|
||||
}
|
||||
|
||||
public function APIGetAllowedParams( &$module, &$params ) {
|
||||
public function APIGetAllowedParams( &$module, &$params, $flags ) {
|
||||
if ( $flags && $this->isAPICaptchaModule( $module ) ) {
|
||||
$params['recaptcha_challenge_field'] = null;
|
||||
$params['recaptcha_response_field'] = null;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function APIGetParamDescription( &$module, &$desc ) {
|
||||
if ( $this->isAPICaptchaModule( $module ) ) {
|
||||
$desc['recaptcha_challenge_field'] = 'Field from the ReCaptcha widget';
|
||||
$desc['recaptcha_response_field'] = 'Field from the ReCaptcha widget';
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue