Go to the documentation of this file.
40 $resetRoutes = $this->
getConfig()->get(
'PasswordResetRoutes' );
41 $this->
hasAnyRoutes = !empty( $resetRoutes[
'username'] ) || !empty( $resetRoutes[
'email'] );
48 return 'apihelp-resetpassword-extended-description-noroutes';
50 return parent::getExtendedDescription();
55 $this->
dieWithError(
'apihelp-resetpassword-description-noroutes',
'moduledisabled' );
66 $passwordReset = MediaWikiServices::getInstance()->getPasswordReset();
73 $status = $passwordReset->execute(
74 $this->
getUser(), $params[
'user'], $params[
'email']
82 $result->addValue( [
'resetpassword' ],
'status',
'success' );
110 $resetRoutes = $this->
getConfig()->get(
'PasswordResetRoutes' );
111 if ( empty( $resetRoutes[
'username'] ) ) {
112 unset( $ret[
'user'] );
114 if ( empty( $resetRoutes[
'email'] ) ) {
115 unset( $ret[
'email'] );
123 $resetRoutes = $this->
getConfig()->get(
'PasswordResetRoutes' );
125 if ( !empty( $resetRoutes[
'username'] ) ) {
126 $ret[
'action=resetpassword&user=Example&token=123ABC'] =
'apihelp-resetpassword-example-user';
128 if ( !empty( $resetRoutes[
'email'] ) ) {
129 $ret[
'action=resetpassword&user=user@example.com&token=123ABC'] =
130 'apihelp-resetpassword-example-email';
137 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Manage_authentication_data';
Reset password, with AuthManager.
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
dieWithError( $msg, $code=null, $data=null, $httpCode=null)
Abort execution with an error.
getExtendedDescription()
Return the extended help text message.
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
getResult()
Get the result object.
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
This abstract class implements many basic API functions, and is the base of all API classes.
getExamplesMessages()
Returns usage examples for this module.
static wrap( $sv)
Succinct helper method to wrap a StatusValue.
getHelpUrls()
Return links to more detailed help pages about the module.
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
isWriteMode()
Indicates whether this module requires write mode.
hasAnyRoutes()
Determine whether any reset routes are available.
requireOnlyOneParameter( $params, $required)
Die if none or more than one of a certain set of parameters is set and not false.
needsToken()
Returns the token type this module requires in order to execute.
dieStatus(StatusValue $status)
Throw an ApiUsageException based on the Status object.