27 parent::__construct( $main, $action,
'changeauth' );
28 $this->authManager = $authManager;
32 if ( !$this->
getUser()->isNamed() ) {
33 $this->
dieWithError(
'apierror-mustbeloggedin-changeauthenticationdata',
'notloggedin' );
39 $helper->securitySensitiveOperation(
'ChangeCredentials' );
43 $helper->loadAuthenticationRequests( AuthManager::ACTION_CHANGE ),
46 if ( count( $reqs ) !== 1 ) {
47 $this->
dieWithError(
'apierror-changeauth-norequest',
'badrequest' );
49 $req = reset( $reqs );
52 $status = $this->authManager->allowsAuthenticationDataChange( $req,
true );
53 $this->
getHookRunner()->onChangeAuthenticationDataAudit( $req, $status );
54 if ( !$status->isGood() ) {
57 $this->authManager->changeAuthenticationData( $req );
59 $this->
getResult()->addValue(
null,
'changeauthenticationdata', [
'status' =>
'success' ] );
81 return [
'api-help-authmanagerhelper-additional-params', AuthManager::ACTION_CHANGE ];
87 'action=changeauthenticationdata' .
88 '&changeauthrequest=MediaWiki%5CAuth%5CPasswordAuthenticationRequest' .
89 '&password=ExamplePassword&retype=ExamplePassword&changeauthtoken=123ABC'
90 =>
'apihelp-changeauthenticationdata-example-password',
96 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Manage_authentication_data';
101class_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()