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();
68 $status = $passwordReset->isAllowed( $this->
getUser() );
69 if ( !$status->isOK() ) {
70 $this->
dieStatus( Status::wrap( $status ) );
73 $status = $passwordReset->execute(
74 $this->
getUser(), $params[
'user'], $params[
'email']
76 if ( !$status->isOK() ) {
77 $status->value =
null;
78 $this->
dieStatus( Status::wrap( $status ) );
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';
This abstract class implements many basic API functions, and is the base of all API classes.
dieWithError( $msg, $code=null, $data=null, $httpCode=null)
Abort execution with an error.
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
getResult()
Get the result object.
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
dieStatus(StatusValue $status)
Throw an ApiUsageException based on the Status object.
requireOnlyOneParameter( $params, $required)
Die if none or more than one of a certain set of parameters is set and not false.
Reset password, with AuthManager.
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
getExtendedDescription()
Return the extended help text message.
getExamplesMessages()
Returns usage examples for this module.
isWriteMode()
Indicates whether this module requires write mode.
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
needsToken()
Returns the token type this module requires in order to execute.
hasAnyRoutes()
Determine whether any reset routes are available.
getHelpUrls()
Return links to more detailed help pages about the module.