mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-11-24 08:13:53 +00:00
Return captcha information via createaccount API only if no other errors
Bug: 61704 Change-Id: I707aab2c0accff8ab5a36666c49815106356b2c7
This commit is contained in:
parent
a32cd4f168
commit
8a336ddd9a
|
@ -828,18 +828,18 @@ class SimpleCaptcha {
|
||||||
* Pass extra data back in API results for account creation.
|
* Pass extra data back in API results for account creation.
|
||||||
*
|
*
|
||||||
* @param ApiCreateAccount $apiModule
|
* @param ApiCreateAccount $apiModule
|
||||||
* @param LoginForm &loginForm
|
* @param LoginForm &loginPage
|
||||||
* @param array &$params
|
* @param array &$result
|
||||||
* @return hook return value
|
* @return bool: Hook return value
|
||||||
*/
|
*/
|
||||||
function addNewAccountApiResult( $apiModule, $loginPage, &$result ) {
|
function addNewAccountApiResult( $apiModule, $loginPage, &$result ) {
|
||||||
if ( $result['result'] !== 'Success' && $this->needCreateAccountCaptcha() ) {
|
if ( $result['result'] !== 'Success' && $this->needCreateAccountCaptcha() ) {
|
||||||
$this->addCaptchaAPI( $result );
|
|
||||||
|
|
||||||
// If we failed a captcha, override the generic 'Warning' result string
|
// If we failed a captcha, override the generic 'Warning' result string
|
||||||
if ( $result['result'] === 'Warning' && isset( $result['warnings'] ) ) {
|
if ( $result['result'] === 'Warning' && isset( $result['warnings'] ) ) {
|
||||||
foreach ( $result['warnings'] as $warning ) {
|
foreach ( $result['warnings'] as $warning ) {
|
||||||
if ( $warning['message'] === 'captcha-createaccount-fail' ) {
|
if ( $warning['message'] === 'captcha-createaccount-fail' ) {
|
||||||
|
$this->addCaptchaAPI( $result );
|
||||||
$result['result'] = 'NeedCaptcha';
|
$result['result'] = 'NeedCaptcha';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue