Manual:Hooks/isValidPassword

From MediaWiki.org
Jump to navigation Jump to search
isValidPassword
Available from version 1.11.0
Override the result of User::isValidPassword()
Define function:
public static function onisValidPassword( $password, &$result, $user ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"isValidPassword": "MyExtensionHooks::onisValidPassword"
	}
}

For MediaWiki ≤1.25:

$wgHooks['isValidPassword'][] = 'MyExtensionHooks::onisValidPassword';
Called from:File(s): User.php

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

Details[edit]

  • $password: Desired password.
  • &$result: Set this and return false to override the internal checks.
  • $user: User the password is being validated for.