From 4bdff3636fc087ebbcd703275ffac7b240b162c5 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 13 Dec 2006 08:33:31 +0000 Subject: [PATCH] Consolidate checks against $wgMinimalPasswordLength to use User::isValidPassword --- includes/SpecialPreferences.php | 2 +- includes/User.php | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) 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; } -- 2.20.1