Manual:Hooks/UserComparePasswords

From MediaWiki.org
Jump to: navigation, search
UserComparePasswords
Available from version 1.14.0 (r44815)
Called when checking passwords.

Define function:
public static function onUserComparePasswords( &$hash, &$password, &$userId, &$result ) { ... }

Attach hook:
$wgHooks['UserComparePasswords'][] = 'MyExtensionHooks::onUserComparePasswords';
Called from: User.php

For more information about attaching hooks, see Manual:Hooks.
For examples of extensions using this hook, see Category:UserComparePasswords extensions.


Details[edit]

Return false to override the default password checks.

  • &$hash: String of the password hash (from the database)
  • &$password: String of the plaintext password the user entered
  • &$userId: Integer of the user's ID or boolean false if the user ID was not supplied
  • &$result: If the hook returns false, this boolean value will be checked to determine if the password was valid