public function execute() {
if ( !$this->hasAnyRoutes() ) {
- $this->dieUsage( 'No password reset routes are available.', 'moduledisabled' );
+ $this->dieWithError( 'apihelp-resetpassword-description-noroutes', 'moduledisabled' );
}
$params = $this->extractRequestParams() + [
$passwordReset = new PasswordReset( $this->getConfig(), AuthManager::singleton() );
- $status = $passwordReset->isAllowed( $this->getUser(), $params['capture'] );
+ $status = $passwordReset->isAllowed( $this->getUser() );
if ( !$status->isOK() ) {
$this->dieStatus( Status::wrap( $status ) );
}
$status = $passwordReset->execute(
- $this->getUser(), $params['user'], $params['email'], $params['capture']
+ $this->getUser(), $params['user'], $params['email']
);
if ( !$status->isOK() ) {
$status->value = null;
$result = $this->getResult();
$result->addValue( [ 'resetpassword' ], 'status', 'success' );
- if ( $params['capture'] ) {
- $passwords = $status->getValue() ?: [];
- ApiResult::setArrayType( $passwords, 'kvp', 'user' );
- ApiResult::setIndexedTagName( $passwords, 'p' );
- $result->addValue( [ 'resetpassword' ], 'passwords', $passwords );
- }
}
public function isWriteMode() {
'email' => [
ApiBase::PARAM_TYPE => 'string',
],
- 'capture' => false,
];
$resetRoutes = $this->getConfig()->get( 'PasswordResetRoutes' );