From: Brion Vibber Date: Wed, 13 Dec 2006 08:33:31 +0000 (+0000) Subject: Consolidate checks against $wgMinimalPasswordLength to use User::isValidPassword X-Git-Tag: 1.31.0-rc.0~54917 X-Git-Url: http://git.cyclocoop.org/%22.%24redirect_annul.%22?a=commitdiff_plain;h=4bdff3636fc087ebbcd703275ffac7b240b162c5;p=lhc%2Fweb%2Fwiklou.git Consolidate checks against $wgMinimalPasswordLength to use User::isValidPassword --- diff --git a/includes/SpecialPreferences.php b/includes/SpecialPreferences.php index a622cb890e..ffe9a09efa 100644 --- a/includes/SpecialPreferences.php +++ b/includes/SpecialPreferences.php @@ -206,7 +206,7 @@ class PreferencesForm { function savePreferences() { global $wgUser, $wgOut, $wgParser; global $wgEnableUserEmail, $wgEnableEmail; - global $wgEmailAuthentication, $wgMinimalPasswordLength; + global $wgEmailAuthentication; global $wgAuth; diff --git a/includes/User.php b/includes/User.php index 53e651b02c..597d003667 100644 --- a/includes/User.php +++ b/includes/User.php @@ -1307,14 +1307,14 @@ class User { * @throws PasswordError on failure */ function setPassword( $str ) { - global $wgAuth, $wgMinimalPasswordLength; + global $wgAuth; if( !$wgAuth->allowPasswordChange() ) { throw new PasswordError( wfMsg( 'password-change-forbidden' ) ); } - if( $wgMinimalPasswordLength && - strlen( $str ) < $wgMinimalPasswordLength ) { + if( !$this->isValidPassword( $str ) ) { + global $wgMinimalPasswordLength; throw new PasswordError( wfMsg( 'passwordtooshort', $wgMinimalPasswordLength ) ); } @@ -2075,7 +2075,7 @@ class User { * @return bool True if the given password is correct otherwise False. */ function checkPassword( $password ) { - global $wgAuth, $wgMinimalPasswordLength; + global $wgAuth; $this->load(); // Even though we stop people from creating passwords that @@ -2083,7 +2083,7 @@ class User { // to. Certain authentication plugins do NOT want to save // domain passwords in a mysql database, so we should // check this (incase $wgAuth->strict() is false). - if( strlen( $password ) < $wgMinimalPasswordLength ) { + if( !$this->isValidPassword( $password ) ) { return false; }