Index: trunk/phase3/includes/User.php |
— | — | @@ -624,8 +624,16 @@ |
625 | 625 | * @return bool True or false |
626 | 626 | */ |
627 | 627 | 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 ); |
630 | 638 | } |
631 | 639 | |
632 | 640 | /** |
— | — | @@ -637,21 +645,14 @@ |
638 | 646 | function getPasswordValidity( $password ) { |
639 | 647 | global $wgMinimalPasswordLength, $wgContLang; |
640 | 648 | |
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 ) ) { |
647 | 650 | if( strlen( $password ) < $wgMinimalPasswordLength ) { |
648 | 651 | return 'passwordtooshort'; |
649 | 652 | } elseif ( $wgContLang->lc( $password ) == $wgContLang->lc( $this->mName ) ) { |
650 | 653 | return 'password-name-match'; |
651 | 654 | } |
652 | | - } elseif( $result === true ) { |
| 655 | + } else { |
653 | 656 | return true; |
654 | | - } else { |
655 | | - return $result; //the isValidPassword hook set a string $result and returned true |
656 | 657 | } |
657 | 658 | } |
658 | 659 | |
Index: trunk/phase3/includes/specials/SpecialResetpass.php |
— | — | @@ -68,7 +68,7 @@ |
69 | 69 | |
70 | 70 | function error( $msg ) { |
71 | 71 | global $wgOut; |
72 | | - $wgOut->addWikiText( '<div class="error">' . $msg . '</div>' ); |
| 72 | + $wgOut->addHTML( Xml::element('p', array( 'class' => 'error' ), $msg ) ); |
73 | 73 | } |
74 | 74 | |
75 | 75 | function showForm() { |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -598,9 +598,6 @@ |
599 | 599 | * (bug 18019) Users are now warned when moving a file to a name in use on a |
600 | 600 | shared repository and only users with the 'reupload-shared' permission can |
601 | 601 | 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 |
605 | 602 | * (bug 18909) Add missing Postgres INSERT SELECT wrapper |
606 | 603 | |
607 | 604 | == API changes in 1.16 == |