45 parent::__construct( $main, $action,
'link' );
46 $this->authManager = $authManager;
47 $this->urlUtils = $urlUtils;
52 $msgs = parent::getFinalDescription();
53 $msgs[] = $this->
msg(
'api-help-authmanager-general-usage',
57 AuthManager::ACTION_LINK,
64 if ( !$this->
getUser()->isNamed() ) {
65 $this->
dieWithError(
'apierror-mustbeloggedin-linkaccounts',
'notloggedin' );
72 if (
$params[
'returnurl'] !==
null ) {
73 $bits = $this->urlUtils->parse(
$params[
'returnurl'] );
74 if ( !$bits || $bits[
'scheme'] ===
'' ) {
78 "badurl_{$encParamName}"
86 $helper->securitySensitiveOperation(
'LinkAccounts' );
89 if ( !$this->authManager->canLinkAccounts() ) {
90 $this->
getResult()->addValue(
null,
'linkaccount', $helper->formatAuthenticationResponse(
91 AuthenticationResponse::newFail( $this->msg(
'userlogin-cannot-' . AuthManager::ACTION_LINK ) )
98 $reqs = $helper->loadAuthenticationRequests( AuthManager::ACTION_LINK_CONTINUE );
99 $res = $this->authManager->continueAccountLink( $reqs );
101 $reqs = $helper->loadAuthenticationRequests( AuthManager::ACTION_LINK );
102 $res = $this->authManager->beginAccountLink( $this->
getUser(), $reqs,
$params[
'returnurl'] );
105 $this->
getResult()->addValue(
null,
'linkaccount',
106 $helper->formatAuthenticationResponse( $res ) );
123 'requests',
'messageformat',
'mergerequestfields',
'returnurl',
'continue'
128 return [
'api-help-authmanagerhelper-additional-params', AuthManager::ACTION_LINK ];
133 'action=linkaccount&provider=Example&linkreturnurl=http://example.org/&linktoken=123ABC'
134 =>
'apihelp-linkaccount-example-link',
139 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Linkaccount';
144class_alias( ApiLinkAccount::class,
'ApiLinkAccount' );
wfEscapeWikiText( $input)
Escapes the given text so that it may be output using addWikiText() without any linking,...
array $params
The job parameters.
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()