Jump to content

Manual:Hooks/AbortLogin

From mediawiki.org
AbortLogin
Available from version 1.11.0
Removed in version 1.33.0 (Gerrit change 441513)
Can cancel the login process
Define function:
public static function onAbortLogin( User $user, $password, LoginForm &$retVal, &$msg ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"AbortLogin": "MediaWiki\\Extension\\MyExtension\\Hooks::onAbortLogin"
	}
}
Called from: File(s): specials/SpecialUserLogin.php
Interface: AbortLoginHook.php

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


Details

[edit]
  • $user: User object being authenticated against
  • $password: password being submitted (before validity checks)
  • &$retVal: a LoginForm class constant to return from authenticateUserData (default is LoginForm::ABORTED)
  • &$msg: name of the error message displayed to the user (introduced in 1.18)

Notes

[edit]
  • Can be used to allow an extension (for example, a captcha) to abort the login process
  • For &$retVal, note that client may be using a machine API rather than the HTML user interface.