Manual:Hooks/UserComparePasswords

From mediawiki.org
UserComparePasswords
Available from version 1.14.0 (r44815, codereview)
Removed in version 1.24.0
Called when checking passwords.
Define function:
public static function onUserComparePasswords( &$hash, &$password, &$userId, &$result ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"UserComparePasswords": "MediaWiki\\Extension\\MyExtension\\Hooks::onUserComparePasswords"
	}
}
Called from: File(s): User.php
Interface: UserComparePasswordsHook.php

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


Details[edit]

This hook was removed in Gerrit change 77645 as part of the RFC for improving the storage of passwords.

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