Index: trunk/phase3/docs/hooks.txt |
— | — | @@ -259,6 +259,12 @@ |
260 | 260 | $user: the User object about to be created (read-only, incomplete) |
261 | 261 | $message: out parameter: error message to display on abort |
262 | 262 | |
| 263 | +'AbortNewAccountAuto': Return false to cancel account creation when the |
| 264 | + request is coming from an AuthPlugin or ExtUser, rather than a |
| 265 | + manually-submitted CreateAccount form. |
| 266 | +$user: the User object about to be created (read-only, incomplete) |
| 267 | +$message: out parameter: error message to display on abort |
| 268 | + |
263 | 269 | 'AddNewAccount': after a user account is created |
264 | 270 | $user: the User object that was created. (Parameter added in 1.7) |
265 | 271 | $byEmail: true when account was created "by email" (added in 1.12) |
Index: trunk/phase3/includes/Login.php |
— | — | @@ -232,12 +232,20 @@ |
233 | 233 | # is for an external auth plugin to autocreate the local user first. |
234 | 234 | if ( $this->mUser->getID() == 0 ) { |
235 | 235 | if ( $this->canAutoCreate() == self::SUCCESS ) { |
| 236 | + |
236 | 237 | $isAutoCreated = true; |
237 | 238 | wfDebug( __METHOD__.": creating account\n" ); |
| 239 | + |
| 240 | + if( !wfRunHooks( 'AbortNewAccountAuto', array( $this->mUser, &$this->mCreateResult ) ) ) { |
| 241 | + wfDebug( __METHOD__ . ": a hook blocked creation\n" ); |
| 242 | + return self::ABORTED; |
| 243 | + } |
| 244 | + |
238 | 245 | $result = $this->initUser( true ); |
239 | 246 | if( $result !== self::SUCCESS ){ |
240 | 247 | return $result; |
241 | | - }; |
| 248 | + } |
| 249 | + |
242 | 250 | } else { |
243 | 251 | return $this->canAutoCreate(); |
244 | 252 | } |
— | — | @@ -454,7 +462,7 @@ |
455 | 463 | |
456 | 464 | if( !wfRunHooks( 'AbortNewAccount', array( $this->mUser, &$this->mCreateResult ) ) ) { |
457 | 465 | # Hook point to add extra creation throttles and blocks |
458 | | - wfDebug( "LoginForm::addNewAccountInternal: a hook blocked creation\n" ); |
| 466 | + wfDebug( __METHOD__ . ": a hook blocked creation\n" ); |
459 | 467 | return self::ABORTED; |
460 | 468 | } |
461 | 469 | |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -92,6 +92,8 @@ |
93 | 93 | $template->set(), etc. The hook has access to most of the stuff that will go into the |
94 | 94 | Login/Create form; see the documentation on HTMLForm for syntax for extra fields. |
95 | 95 | LoginForm class is deprecated, its state constants are now in the Login class. |
| 96 | +* New hook AbortNewAccountAuto, called before account creation from AuthPlugin- |
| 97 | + or ExtUser-driven requests. |
96 | 98 | |
97 | 99 | === New features in 1.16 === |
98 | 100 | |