Index: trunk/phase3/docs/hooks.txt |
— | — | @@ -464,6 +464,10 @@ |
465 | 465 | &$text: string containing partially parsed text |
466 | 466 | &$this->mStripState: Parser's internal StripState object |
467 | 467 | |
| 468 | +'isValidPassword': Override the result of User::isValidPassword() |
| 469 | +$password: Desired password |
| 470 | +&$result: Set this and return false to override the internal checks |
| 471 | + |
468 | 472 | 'LoginAuthenticateAudit': a login attempt for a valid user account either succeeded or failed. |
469 | 473 | No return data is accepted; this hook is for auditing only. |
470 | 474 | $user: the User object being authenticated against |
Index: trunk/phase3/includes/User.php |
— | — | @@ -481,19 +481,23 @@ |
482 | 482 | } |
483 | 483 | |
484 | 484 | /** |
485 | | - * Is the input a valid password? |
| 485 | + * Is the input a valid password for this user? |
486 | 486 | * |
487 | | - * @param string $password |
| 487 | + * @param string $password Desired password |
488 | 488 | * @return bool |
489 | 489 | */ |
490 | 490 | function isValidPassword( $password ) { |
491 | 491 | global $wgMinimalPasswordLength, $wgContLang; |
492 | 492 | |
493 | 493 | $result = null; |
494 | | - if( !wfRunHooks( 'isValidPassword', array( $password, &$result ) ) ) return $result; |
495 | | - if ($result === false) return false; |
496 | | - return (strlen( $password ) >= $wgMinimalPasswordLength) && |
497 | | - ($wgContLang->lc( $password ) !== $wgContLang->lc( $this->mName )); |
| 494 | + if( !wfRunHooks( 'isValidPassword', array( $password, &$result ) ) ) |
| 495 | + return $result; |
| 496 | + if( $result === false ) |
| 497 | + return $false; |
| 498 | + |
| 499 | + // Password needs to be long enough, and can't be the same as the username |
| 500 | + return strlen( $password ) >= $wgMinimalPasswordLength |
| 501 | + && $wgContLang->lc( $password ) !== $wgContLang->lc( $this->mName ); |
498 | 502 | } |
499 | 503 | |
500 | 504 | /** |