41 parent::__construct( $main, $action,
'changeauth' );
42 $this->authManager = $authManager;
46 if ( !$this->
getUser()->isNamed() ) {
47 $this->
dieWithError(
'apierror-mustbeloggedin-changeauthenticationdata',
'notloggedin' );
53 $helper->securitySensitiveOperation(
'ChangeCredentials' );
57 $helper->loadAuthenticationRequests( AuthManager::ACTION_CHANGE ),
60 if ( count( $reqs ) !== 1 ) {
61 $this->
dieWithError(
'apierror-changeauth-norequest',
'badrequest' );
63 $req = reset( $reqs );
66 $status = $this->authManager->allowsAuthenticationDataChange( $req,
true );
67 $this->
getHookRunner()->onChangeAuthenticationDataAudit( $req, $status );
68 if ( !$status->isGood() ) {
71 $this->authManager->changeAuthenticationData( $req );
73 $this->
getResult()->addValue(
null,
'changeauthenticationdata', [
'status' =>
'success' ] );
91 return [
'api-help-authmanagerhelper-additional-params', AuthManager::ACTION_CHANGE ];
96 'action=changeauthenticationdata' .
97 '&changeauthrequest=MediaWiki%5CAuth%5CPasswordAuthenticationRequest' .
98 '&password=ExamplePassword&retype=ExamplePassword&changeauthtoken=123ABC'
99 =>
'apihelp-changeauthenticationdata-example-password',
104 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Manage_authentication_data';
109class_alias( ApiChangeAuthenticationData::class,
'ApiChangeAuthenticationData' );
This is the main API class, used for both external and internal processing.
A class containing constants representing the names of configuration variables.
const ChangeCredentialsBlacklist
Name constant for the ChangeCredentialsBlacklist setting, for use with Config::get()