&$text: string containing partially parsed text
&$this->mStripState: Parser's internal StripState object
+'isValidPassword': Override the result of User::isValidPassword()
+$password: Desired password
+&$result: Set this and return false to override the internal checks
+
'LoginAuthenticateAudit': a login attempt for a valid user account either succeeded or failed.
No return data is accepted; this hook is for auditing only.
$user: the User object being authenticated against
}
/**
- * Is the input a valid password?
+ * Is the input a valid password for this user?
*
- * @param string $password
+ * @param string $password Desired password
* @return bool
*/
function isValidPassword( $password ) {
global $wgMinimalPasswordLength, $wgContLang;
$result = null;
- if( !wfRunHooks( 'isValidPassword', array( $password, &$result ) ) ) return $result;
- if ($result === false) return false;
- return (strlen( $password ) >= $wgMinimalPasswordLength) &&
- ($wgContLang->lc( $password ) !== $wgContLang->lc( $this->mName ));
+ if( !wfRunHooks( 'isValidPassword', array( $password, &$result ) ) )
+ 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 );
}
/**