r24204 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r24203‎ | r24204 | r24205 >
Date:16:44, 17 July 2007
Author:robchurch
Status:old
Tags:
Comment:
* Clean up User::isValidPassword()
* Document 'isValidPassword' hook
Modified paths:
  • /trunk/phase3/docs/hooks.txt (modified) (history)
  • /trunk/phase3/includes/User.php (modified) (history)

Diff [purge]

Index: trunk/phase3/docs/hooks.txt
@@ -464,6 +464,10 @@
465465 &$text: string containing partially parsed text
466466 &$this->mStripState: Parser's internal StripState object
467467
 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+
468472 'LoginAuthenticateAudit': a login attempt for a valid user account either succeeded or failed.
469473 No return data is accepted; this hook is for auditing only.
470474 $user: the User object being authenticated against
Index: trunk/phase3/includes/User.php
@@ -481,19 +481,23 @@
482482 }
483483
484484 /**
485 - * Is the input a valid password?
 485+ * Is the input a valid password for this user?
486486 *
487 - * @param string $password
 487+ * @param string $password Desired password
488488 * @return bool
489489 */
490490 function isValidPassword( $password ) {
491491 global $wgMinimalPasswordLength, $wgContLang;
492492
493493 $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 );
498502 }
499503
500504 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r24215Merged revisions 24095-24212 via svnmerge from...david21:19, 17 July 2007

Status & tagging log