r58182 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r58181‎ | r58182 | r58183 >
Date:07:13, 27 October 2009
Author:raymond
Status:ok
Tags:
Comment:
Revert r58171/r58172 for now. It seems it breaks login to translatewiki.net
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/User.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialResetpass.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/User.php
@@ -624,8 +624,16 @@
625625 * @return bool True or false
626626 */
627627 function isValidPassword( $password ) {
628 - //simple boolean wrapper for getPasswordValidity
629 - return $this->getPasswordValidity( $password ) === true;
 628+ global $wgMinimalPasswordLength, $wgContLang;
 629+
 630+ if( !wfRunHooks( 'isValidPassword', array( $password, &$result, $this ) ) )
 631+ return $result;
 632+ if( $result === false )
 633+ return false;
 634+
 635+ // Password needs to be long enough, and can't be the same as the username
 636+ return strlen( $password ) >= $wgMinimalPasswordLength
 637+ && $wgContLang->lc( $password ) !== $wgContLang->lc( $this->mName );
630638 }
631639
632640 /**
@@ -637,21 +645,14 @@
638646 function getPasswordValidity( $password ) {
639647 global $wgMinimalPasswordLength, $wgContLang;
640648
641 - $result = false; //init $result to false for the internal checks
642 -
643 - if( !wfRunHooks( 'isValidPassword', array( $password, &$result, $this ) ) )
644 - return $result;
645 -
646 - if ( $result === false ) {
 649+ if ( !$this->isValidPassword( $password ) ) {
647650 if( strlen( $password ) < $wgMinimalPasswordLength ) {
648651 return 'passwordtooshort';
649652 } elseif ( $wgContLang->lc( $password ) == $wgContLang->lc( $this->mName ) ) {
650653 return 'password-name-match';
651654 }
652 - } elseif( $result === true ) {
 655+ } else {
653656 return true;
654 - } else {
655 - return $result; //the isValidPassword hook set a string $result and returned true
656657 }
657658 }
658659
Index: trunk/phase3/includes/specials/SpecialResetpass.php
@@ -68,7 +68,7 @@
6969
7070 function error( $msg ) {
7171 global $wgOut;
72 - $wgOut->addWikiText( '<div class="error">' . $msg . '</div>' );
 72+ $wgOut->addHTML( Xml::element('p', array( 'class' => 'error' ), $msg ) );
7373 }
7474
7575 function showForm() {
Index: trunk/phase3/RELEASE-NOTES
@@ -598,9 +598,6 @@
599599 * (bug 18019) Users are now warned when moving a file to a name in use on a
600600 shared repository and only users with the 'reupload-shared' permission can
601601 complete the move.
602 -* User::isValidPassword now only returns boolean results, User::getPasswordValidity
603 - can be used to get an error message string
604 -* The error message shown in Special:ChangePassword now parses wiki markup
605602 * (bug 18909) Add missing Postgres INSERT SELECT wrapper
606603
607604 == API changes in 1.16 ==

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r58171* Any strings returned by the isValidPassword hook are now shown as error mes...skizzerz22:58, 26 October 2009
r58172* User::isValidPassword now only returns boolean results, User::getPasswordVa...skizzerz23:19, 26 October 2009

Status & tagging log