28 parent::__construct( $main, $action,
'link' );
34 $msgs = parent::getFinalDescription();
35 $msgs[] = $this->
msg(
'api-help-authmanager-general-usage',
39 AuthManager::ACTION_LINK,
46 if ( !$this->
getUser()->isNamed() ) {
47 $this->
dieWithError(
'apierror-mustbeloggedin-linkaccounts',
'notloggedin' );
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 $helper->securitySensitiveOperation(
'LinkAccounts' );
73 if ( !$this->authManager->canLinkAccounts() ) {
74 $this->
getResult()->addValue(
null,
'linkaccount', $helper->formatAuthenticationResponse(
75 AuthenticationResponse::newFail( $this->msg(
'userlogin-cannot-' . AuthManager::ACTION_LINK ) )
81 if ( $params[
'continue'] ) {
82 $reqs = $helper->loadAuthenticationRequests( AuthManager::ACTION_LINK_CONTINUE );
83 $res = $this->authManager->continueAccountLink( $reqs );
85 $reqs = $helper->loadAuthenticationRequests( AuthManager::ACTION_LINK );
86 $res = $this->authManager->beginAccountLink( $this->
getUser(), $reqs, $params[
'returnurl'] );
89 $this->
getResult()->addValue(
null,
'linkaccount',
90 $helper->formatAuthenticationResponse( $res ) );
111 'requests',
'messageformat',
'mergerequestfields',
'returnurl',
'continue'
117 return [
'api-help-authmanagerhelper-additional-params', AuthManager::ACTION_LINK ];
123 'action=linkaccount&provider=Example&linkreturnurl=http://example.org/&linktoken=123ABC'
124 =>
'apihelp-linkaccount-example-link',
130 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Linkaccount';
135class_alias( ApiLinkAccount::class,
'ApiLinkAccount' );
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()