MaxSem has uploaded a new change for review.
https://gerrit.wikimedia.org/r/111118
Change subject: Update ConfirmEdit to return Status object on AbortNewAccount
hook
......................................................................
Update ConfirmEdit to return Status object on AbortNewAccount hook
Requires core update I6ae34c0 to actually send the message key back
in the error response. On older MediaWiki versions, behavior should
remain unchanged.
Bug: 60008
Change-Id: If9cc08e44d1d2efacf817b8c6cbb2d71a4e8b692
(cherry picked from commit 19dcbb6fa20c2eafab30227c581090d5d6b3d0e5)
---
M Captcha.php
M ConfirmEditHooks.php
2 files changed, 7 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ConfirmEdit
refs/changes/18/111118/1
diff --git a/Captcha.php b/Captcha.php
index 19f70ae..2152ab5 100644
--- a/Captcha.php
+++ b/Captcha.php
@@ -537,13 +537,17 @@
* Hook for user creation form submissions.
* @param User $u
* @param string $message
+ * @param Status $status
* @return bool true to continue, false to abort user creation
*/
- function confirmUserCreate( $u, &$message ) {
+ function confirmUserCreate( $u, &$message, &$status = null ) {
if ( $this->needCreateAccountCaptcha() ) {
$this->trigger = "new account '" . $u->getName() . "'";
if ( !$this->passCaptcha() ) {
+ // For older MediaWiki
$message = wfMessage(
'captcha-createaccount-fail' )->text();
+ // For MediaWiki 1.23+
+ $status = Status::newFatal(
'captcha-createaccount-fail' );
return false;
}
}
diff --git a/ConfirmEditHooks.php b/ConfirmEditHooks.php
index c03e316..8126e2a 100644
--- a/ConfirmEditHooks.php
+++ b/ConfirmEditHooks.php
@@ -39,8 +39,8 @@
return self::getInstance()->injectUserCreate( $template );
}
- static function confirmUserCreate( $u, &$message ) {
- return self::getInstance()->confirmUserCreate( $u, $message );
+ static function confirmUserCreate( $u, &$message, &$status = null ) {
+ return self::getInstance()->confirmUserCreate( $u, $message,
$status );
}
static function triggerUserLogin( $user, $password, $retval ) {
--
To view, visit https://gerrit.wikimedia.org/r/111118
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If9cc08e44d1d2efacf817b8c6cbb2d71a4e8b692
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ConfirmEdit
Gerrit-Branch: wmf/1.23wmf11
Gerrit-Owner: MaxSem <[email protected]>
Gerrit-Reviewer: Brion VIBBER <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits