31 parent::__construct( $main, $action,
'create' );
32 $this->authManager = $authManager;
33 $this->urlUtils = $urlUtils;
39 $msgs = parent::getFinalDescription();
40 $msgs[] = $this->
msg(
'api-help-authmanager-general-usage',
44 AuthManager::ACTION_CREATE,
56 if ( $params[
'returnurl'] !==
null ) {
57 $bits = $this->urlUtils->parse( $params[
'returnurl'] );
58 if ( !$bits || $bits[
'scheme'] ===
'' ) {
61 [
'apierror-badurl', $encParamName,
wfEscapeWikiText( $params[
'returnurl'] ) ],
62 "badurl_{$encParamName}"
70 if ( !$this->authManager->canCreateAccounts() ) {
71 $res = AuthenticationResponse::newFail( $this->
msg(
'userlogin-cannot-' . AuthManager::ACTION_CREATE ) );
72 $this->
getResult()->addValue(
null,
'createaccount',
73 $helper->formatAuthenticationResponse( $res ) );
74 $helper->logAuthenticationResult(
'accountcreation', $performer, $res );
79 if ( $params[
'continue'] ) {
80 $reqs = $helper->loadAuthenticationRequests( AuthManager::ACTION_CREATE_CONTINUE );
81 $res = $this->authManager->continueAccountCreation( $reqs );
83 $reqs = $helper->loadAuthenticationRequests( AuthManager::ACTION_CREATE );
84 if ( $params[
'preservestate'] ) {
85 $req = $helper->getPreservedRequest();
90 $res = $this->authManager->beginAccountCreation(
97 $this->
getResult()->addValue(
null,
'createaccount',
98 $helper->formatAuthenticationResponse( $res ) );
99 $helper->logAuthenticationResult(
'accountcreation', $performer, $res );
114 return 'createaccount';
120 'requests',
'messageformat',
'mergerequestfields',
'preservestate',
'returnurl',
'continue'
123 'apihelp-createaccount-param-preservestate';
129 return [
'api-help-authmanagerhelper-additional-params', AuthManager::ACTION_CREATE ];
135 'action=createaccount&username=Example&password=ExamplePassword&retype=ExamplePassword'
136 .
'&createreturnurl=http://example.org/&createtoken=123ABC'
137 =>
'apihelp-createaccount-example-create',
143 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Account_creation';
148class_alias( ApiAMCreateAccount::class,
'ApiAMCreateAccount' );
wfEscapeWikiText( $input)
Escapes the given text so that it may be output using addWikiText() without any linking,...
This is the main API class, used for both external and internal processing.
msg( $key,... $params)
Get a Message object with context set Parameters are the same as wfMessage()