Index: trunk/phase3/docs/hooks.txt |
— | — | @@ -234,6 +234,10 @@ |
235 | 235 | This is a list of known events and parameters; please add to it if you're going |
236 | 236 | to add events to the MediaWiki code. |
237 | 237 | |
| 238 | +'AbortAutoAccount': Return false to cancel automated local account creation, where normally authentication against an external auth plugin would be creating a local account. |
| 239 | +$user: the User object about to be created (read-only, incomplete) |
| 240 | +$message: out parameter: error message to be displayed to user |
| 241 | + |
238 | 242 | 'AbortAutoblock': Return false to cancel an autoblock. |
239 | 243 | $autoblockip: The IP going to be autoblocked. |
240 | 244 | $block: The block from which the autoblock is coming. |
— | — | @@ -256,7 +260,7 @@ |
257 | 261 | $err: error message |
258 | 262 | $reason: the reason for the move (added in 1.13) |
259 | 263 | |
260 | | -'AbortNewAccount': Return false to cancel account creation. |
| 264 | +'AbortNewAccount': Return false to cancel explicit account creation. |
261 | 265 | $user: the User object about to be created (read-only, incomplete) |
262 | 266 | $message: out parameter: error message to display on abort |
263 | 267 | |
Index: trunk/phase3/includes/specials/SpecialUserlogin.php |
— | — | @@ -639,6 +639,14 @@ |
640 | 640 | } |
641 | 641 | } |
642 | 642 | |
| 643 | + $abortError = ''; |
| 644 | + if( !wfRunHooks( 'AbortAutoAccount', array( $user, &$abortError ) ) ) { |
| 645 | + // Hook point to add extra creation throttles and blocks |
| 646 | + wfDebug( "LoginForm::attemptAutoCreate: a hook blocked creation: $abortError\n" ); |
| 647 | + $this->mAbortLoginErrorMsg = $abortError; |
| 648 | + return self::ABORTED; |
| 649 | + } |
| 650 | + |
643 | 651 | wfDebug( __METHOD__ . ": creating account\n" ); |
644 | 652 | $this->initUser( $user, true ); |
645 | 653 | return self::SUCCESS; |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -120,7 +120,13 @@ |
121 | 121 | * The parser now attempts to output markers for editsection tokens and defer the |
122 | 122 | rendering of them post-cache to reduce parser cache fragmentation and ensure |
123 | 123 | skin customizability of edit section links. |
| 124 | +* (bug 24755) AuthPlugin auto-creation of local accounts can now be aborted by |
| 125 | + other extensions by handling the 'AbortAutoAccount' hook, similar to the |
| 126 | + 'AbortNewAccount' triggered by explicit account creations. (They are separate |
| 127 | + to avoid loops and confusion; auth plugins like CentralAuth need to handle |
| 128 | + AbortNewAccount separately. |
124 | 129 | |
| 130 | + |
125 | 131 | === Bug fixes in 1.18 === |
126 | 132 | * (bug 23119) WikiError class and subclasses are now marked as deprecated |
127 | 133 | * (bug 10871) Javascript and CSS pages in MediaWiki namespace are no longer |
Index: trunk/extensions/TitleBlacklist/TitleBlacklist.php |
— | — | @@ -47,6 +47,7 @@ |
48 | 48 | $wgHooks['getUserPermissionsErrorsExpensive'][] = 'TitleBlacklistHooks::userCan'; |
49 | 49 | $wgHooks['AbortMove'][] = 'TitleBlacklistHooks::abortMove'; |
50 | 50 | $wgHooks['AbortNewAccount'][] = 'TitleBlacklistHooks::abortNewAccount'; |
| 51 | +$wgHooks['AbortAutoAccount'][] = 'TitleBlacklistHooks::abortNewAccount'; |
51 | 52 | $wgHooks['CentralAuthAutoCreate'][] = 'TitleBlacklistHooks::centralAuthAutoCreate'; |
52 | 53 | $wgHooks['EditFilter'][] = 'TitleBlacklistHooks::validateBlacklist'; |
53 | 54 | $wgHooks['ArticleSaveComplete'][] = 'TitleBlacklistHooks::clearBlacklist'; |
Index: trunk/extensions/CentralAuth/CentralAuthHooks.php |
— | — | @@ -442,6 +442,13 @@ |
443 | 443 | wfDebug( __METHOD__ . ": denied by other extensions\n" ); |
444 | 444 | return false; |
445 | 445 | } |
| 446 | + $abortMessage = ''; |
| 447 | + if ( !wfRunHooks( 'AbortAutoAccount', array( $user, &$abortMessage ) ) ) { |
| 448 | + // In this case we have no way to return the message to the user, |
| 449 | + // but we can log it. |
| 450 | + wfDebug( __METHOD__ . ": denied by other extension: $abortMessage\n" ); |
| 451 | + return false; |
| 452 | + } |
446 | 453 | |
447 | 454 | // Checks passed, create the user |
448 | 455 | wfDebug( __METHOD__ . ": creating new user\n" ); |