Manual:Hooks/UserComparePasswords

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

*Define function:
function fnMyHook( &$hash, &$password, &$userId, &$result ) { ... }

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

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


[edit] Details

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
Personal tools
Namespaces
Variants
Actions
Site
Support
Download
Development
Communication
Print/export
Toolbox