r61788 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61787‎ | r61788 | r61789 >
Date:14:51, 1 February 2010
Author:demon
Status:ok
Tags:
Comment:
Cleanup r61694, move blocked check to after password check, global auth checks, etc. Prevents hunting for blocked users
Modified paths:
  • /trunk/phase3/includes/specials/SpecialUserlogin.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialUserlogin.php
@@ -417,12 +417,6 @@
418418 return self::THROTTLED;
419419 }
420420 }
421 - // If we've enabled it, make it so that a blocked user cannot login
422 - global $wgBlockDisablesLogin;
423 - $u = User::newFromName( $this->mName );
424 - if( $wgBlockDisablesLogin && !is_null( $u ) && $u->isBlocked() ) {
425 - return self::USER_BLOCKED;
426 - }
427421
428422 // Load $wgUser now, and check to see if we're logging in as the same
429423 // name. This is necessary because loading $wgUser (say by calling
@@ -439,6 +433,7 @@
440434
441435 # TODO: Allow some magic here for invalid external names, e.g., let the
442436 # user choose a different wiki name.
 437+ $u = User::newFromName( $this->mName );
443438 if( is_null( $u ) || !User::isUsableName( $u->getName() ) ) {
444439 return self::ILLEGAL;
445440 }
@@ -470,6 +465,7 @@
471466 return $abort;
472467 }
473468
 469+ global $wgBlockDisablesLogin;
474470 if (!$u->checkPassword( $this->mPassword )) {
475471 if( $u->checkTemporaryPassword( $this->mPassword ) ) {
476472 // The e-mailed temporary password should not be used for actu-
@@ -500,6 +496,9 @@
501497 } else {
502498 $retval = ($this->mPassword == '') ? self::EMPTY_PASS : self::WRONG_PASS;
503499 }
 500+ } elseif ( $wgBlockDisablesLogin && $u->isBlocked() ) {
 501+ // If we've enabled it, make it so that a blocked user cannot login
 502+ $retval = self::USER_BLOCKED;
504503 } else {
505504 $wgAuth->updateUser( $u );
506505 $wgUser = $u;

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r61694Add new global $wgBlockDisablesLogin to prevent logging in by blocked users, ...demon23:29, 29 January 2010

Status & tagging log