r110797 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110796‎ | r110797 | r110798 >
Date:22:44, 6 February 2012
Author:demon
Status:ok
Tags:
Comment:
Revert r103467, r106446 (bug 24464: calling LoginAuthenticateAudit hook more often)

Pretty narrow use case isn't very well defined, and this has *felt wrong* to me since
it was committed in November. Easier to pull for now rather than blocking release.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES-1.19 (modified) (history)
  • /trunk/phase3/docs/hooks.txt (modified) (history)
  • /trunk/phase3/includes/specials/SpecialUserlogin.php (modified) (history)

Diff [purge]

Index: trunk/phase3/docs/hooks.txt
@@ -1238,10 +1238,8 @@
12391239 - 'comment' Wikitext string in the same format as an edit summary
12401240 - 'timestamp' Timestamp when the action occured
12411241
1242 -'LoginAuthenticateAudit': a login attempt either succeeded or
1243 -failed. This may be called before the User object is populated, so a
1244 -user object equivalent to an anonymous user. No return data is
1245 -accepted; this hook is for auditing only.
 1242+LoginAuthenticateAudit': a login attempt for a valid user account either
 1243+succeeded or failed. No return data is accepted; this hook is for auditing only.
12461244 $user: the User object being authenticated against
12471245 $password: the password being submitted and found wanting
12481246 $retval: a LoginForm class constant with authenticateUserData() return
Index: trunk/phase3/RELEASE-NOTES-1.19
@@ -11,9 +11,6 @@
1212 production.
1313
1414 === Configuration changes in 1.19 ===
15 -* Changed LoginAuthenticateAudit hook so that it may be called before a
16 - valid user is available. In those cases, an anonymouse user object
17 - will be supplied.
1815 * Removed SkinTemplateSetupPageCss hook; use BeforePageDisplay instead.
1916 * (bug 27132) movefile right granted by default to registered users.
2017 * Default cookie lifetime ($wgCookieExpiration) is increased to 180 days.
Index: trunk/phase3/includes/specials/SpecialUserlogin.php
@@ -477,7 +477,6 @@
478478 $this->load();
479479
480480 if ( $this->mUsername == '' ) {
481 - wfRunHooks( 'LoginAuthenticateAudit', array( new User, $this->mPassword, self::NO_NAME ) );
482481 return self::NO_NAME;
483482 }
484483
@@ -489,24 +488,20 @@
490489 // If the user doesn't have a login token yet, set one.
491490 if ( !self::getLoginToken() ) {
492491 self::setLoginToken();
493 - wfRunHooks( 'LoginAuthenticateAudit', array( new User, $this->mPassword, self::NEED_TOKEN ) );
494492 return self::NEED_TOKEN;
495493 }
496494 // If the user didn't pass a login token, tell them we need one
497495 if ( !$this->mToken ) {
498 - wfRunHooks( 'LoginAuthenticateAudit', array( new User, $this->mPassword, self::NEED_TOKEN ) );
499496 return self::NEED_TOKEN;
500497 }
501498
502499 $throttleCount = self::incLoginThrottle( $this->mUsername );
503500 if ( $throttleCount === true ) {
504 - wfRunHooks( 'LoginAuthenticateAudit', array( new User, $this->mPassword, self::THROTTLED ) );
505501 return self::THROTTLED;
506502 }
507503
508504 // Validate the login token
509505 if ( $this->mToken !== self::getLoginToken() ) {
510 - wfRunHooks( 'LoginAuthenticateAudit', array( new User, $this->mPassword, self::WRONG_TOKEN ) );
511506 return self::WRONG_TOKEN;
512507 }
513508
@@ -526,20 +521,14 @@
527522 # TODO: Allow some magic here for invalid external names, e.g., let the
528523 # user choose a different wiki name.
529524 $u = User::newFromName( $this->mUsername );
530 - if( !( $u instanceof User ) ) {
531 - wfRunHooks( 'LoginAuthenticateAudit', array( new User, $this->mPassword, self::ILLEGAL ) );
 525+ if( !( $u instanceof User ) || !User::isUsableName( $u->getName() ) ) {
532526 return self::ILLEGAL;
533527 }
534 - if( !User::isUsableName( $u->getName() ) ) {
535 - wfRunHooks( 'LoginAuthenticateAudit', array( $u, $this->mPassword, self::ILLEGAL ) );
536 - return self::ILLEGAL;
537 - }
538528
539529 $isAutoCreated = false;
540530 if ( 0 == $u->getID() ) {
541531 $status = $this->attemptAutoCreate( $u );
542532 if ( $status !== self::SUCCESS ) {
543 - wfRunHooks( 'LoginAuthenticateAudit', array( $u, $this->mPassword, $status ) );
544533 return $status;
545534 } else {
546535 $isAutoCreated = true;
@@ -560,7 +549,6 @@
561550 // Give general extensions, such as a captcha, a chance to abort logins
562551 $abort = self::ABORTED;
563552 if( !wfRunHooks( 'AbortLogin', array( $u, $this->mPassword, &$abort, &$this->mAbortLoginErrorMsg ) ) ) {
564 - wfRunHooks( 'LoginAuthenticateAudit', array( $u, $this->mPassword, $abort ) );
565553 return $abort;
566554 }
567555

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r103396Applying Michael Newton's patch from Bug 24464 - Execute...mah22:24, 16 November 2011
r103467Adapt and re-apply Michael Newton's patch from Bug 24464 - Execute...mah15:16, 17 November 2011
r106446followup r103467 - Make sure we pass a user object when we call LoginAuthenti...mah17:19, 16 December 2011

Status & tagging log