17 if ( $params[
'user'] !==
null ) {
23 "baduser_{$encParamName}"
27 if ( !$user->isAnon() ||
28 MediaWikiServices::getInstance()->getAuthManager()->userExists( $user->getName() )
33 $user->setEmail( (
string)$params[
'email'] );
34 $user->setRealName( (
string)$params[
'realname'] );
40 $validity = $user->checkPasswordValidity( $params[
'password'] );
41 $r[
'validity'] = $validity->isGood() ?
'Good' : ( $validity->isOK() ?
'Change' :
'Invalid' );
42 $messages = array_merge(
47 $r[
'validitymessages'] = $messages;
67 UserDef::PARAM_ALLOWED_USER_TYPES => [
'name',
'id' ],
76 'action=validatepassword&password=foobar'
77 =>
'apihelp-validatepassword-example-1',
78 'action=validatepassword&password=querty&user=Example'
79 =>
'apihelp-validatepassword-example-2',
84 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Validatepassword';
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
This abstract class implements many basic API functions, and is the base of all API classes.
dieWithError( $msg, $code=null, $data=null, $httpCode=0)
Abort execution with an error.
encodeParamName( $paramName)
This method mangles parameter name based on the prefix supplied to the constructor.
getErrorFormatter()
Get the error formatter Stable to override.
requirePostedParameters( $params, $prefix='prefix')
Die if any of the specified parameters were found in the query part of the URL rather than the post b...
getResult()
Get the result object.
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
getModuleName()
Get the name of the module being executed by this instance.
getHookRunner()
Get an ApiHookRunner for running core API hooks.
getExamplesMessages()
Returns usage examples for this module.
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
mustBePosted()
Indicates whether this module must be called with a POST request Stable to override.
getHelpUrls()
Return links to more detailed help pages about the module.
static newFromName( $name, $validate='valid')
Static factory method for creation from username.