From c4b785221ffe04ff775ba874fa295213af339282 Mon Sep 17 00:00:00 2001 From: Raimond Spekking Date: Tue, 27 Oct 2009 07:13:13 +0000 Subject: [PATCH] Revert r58171/r58172 for now. It seems it breaks login to translatewiki.net --- RELEASE-NOTES | 3 --- includes/User.php | 23 ++++++++++++----------- includes/specials/SpecialResetpass.php | 2 +- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 1650305034..e9dcc56a54 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -598,9 +598,6 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 18019) Users are now warned when moving a file to a name in use on a shared repository and only users with the 'reupload-shared' permission can complete the move. -* User::isValidPassword now only returns boolean results, User::getPasswordValidity - can be used to get an error message string -* The error message shown in Special:ChangePassword now parses wiki markup * (bug 18909) Add missing Postgres INSERT SELECT wrapper == API changes in 1.16 == diff --git a/includes/User.php b/includes/User.php index 7998f1b5be..d4cfbd7852 100644 --- a/includes/User.php +++ b/includes/User.php @@ -624,8 +624,16 @@ class User { * @return bool True or false */ function isValidPassword( $password ) { - //simple boolean wrapper for getPasswordValidity - return $this->getPasswordValidity( $password ) === true; + global $wgMinimalPasswordLength, $wgContLang; + + if( !wfRunHooks( 'isValidPassword', array( $password, &$result, $this ) ) ) + return $result; + if( $result === false ) + return false; + + // Password needs to be long enough, and can't be the same as the username + return strlen( $password ) >= $wgMinimalPasswordLength + && $wgContLang->lc( $password ) !== $wgContLang->lc( $this->mName ); } /** @@ -637,21 +645,14 @@ class User { function getPasswordValidity( $password ) { global $wgMinimalPasswordLength, $wgContLang; - $result = false; //init $result to false for the internal checks - - if( !wfRunHooks( 'isValidPassword', array( $password, &$result, $this ) ) ) - return $result; - - if ( $result === false ) { + if ( !$this->isValidPassword( $password ) ) { if( strlen( $password ) < $wgMinimalPasswordLength ) { return 'passwordtooshort'; } elseif ( $wgContLang->lc( $password ) == $wgContLang->lc( $this->mName ) ) { return 'password-name-match'; } - } elseif( $result === true ) { - return true; } else { - return $result; //the isValidPassword hook set a string $result and returned true + return true; } } diff --git a/includes/specials/SpecialResetpass.php b/includes/specials/SpecialResetpass.php index 86bf0b875b..3e49354488 100644 --- a/includes/specials/SpecialResetpass.php +++ b/includes/specials/SpecialResetpass.php @@ -68,7 +68,7 @@ class SpecialResetpass extends SpecialPage { function error( $msg ) { global $wgOut; - $wgOut->addWikiText( '
' . $msg . '
' ); + $wgOut->addHTML( Xml::element('p', array( 'class' => 'error' ), $msg ) ); } function showForm() { -- 2.20.1