46 parent::__construct( $main, $action,
'login' );
47 $this->authManager = $authManager;
48 $this->urlUtils = $urlUtils;
53 $msgs = parent::getFinalDescription();
54 $msgs[] = $this->
msg(
'api-help-authmanager-general-usage',
58 AuthManager::ACTION_LOGIN,
70 if (
$params[
'returnurl'] !==
null ) {
71 $bits = $this->urlUtils->parse(
$params[
'returnurl'] );
72 if ( !$bits || $bits[
'scheme'] ===
'' ) {
76 "badurl_{$encParamName}"
84 if ( !$this->authManager->canAuthenticateNow() ) {
85 $res = AuthenticationResponse::newFail( $this->
msg(
'userlogin-cannot-' . AuthManager::ACTION_LOGIN ) );
86 $this->
getResult()->addValue(
null,
'clientlogin',
87 $helper->formatAuthenticationResponse( $res ) );
88 $helper->logAuthenticationResult(
'login', $performer, $res );
94 $reqs = $helper->loadAuthenticationRequests( AuthManager::ACTION_LOGIN_CONTINUE );
95 $res = $this->authManager->continueAuthentication( $reqs );
97 $reqs = $helper->loadAuthenticationRequests( AuthManager::ACTION_LOGIN );
98 if (
$params[
'preservestate'] ) {
99 $req = $helper->getPreservedRequest();
104 $res = $this->authManager->beginAuthentication( $reqs,
$params[
'returnurl'] );
111 $res->neededRequests, [ CreateFromLoginAuthenticationRequest::class ]
114 $this->
getResult()->addValue(
null,
'clientlogin',
115 $helper->formatAuthenticationResponse( $res ) );
116 $helper->logAuthenticationResult(
'login', $performer, $res );
134 'requests',
'messageformat',
'mergerequestfields',
'preservestate',
'returnurl',
'continue'
139 return [
'api-help-authmanagerhelper-additional-params', AuthManager::ACTION_LOGIN ];
144 'action=clientlogin&username=Example&password=ExamplePassword&'
145 .
'loginreturnurl=http://example.org/&logintoken=123ABC'
146 =>
'apihelp-clientlogin-example-login',
147 'action=clientlogin&logincontinue=1&OATHToken=987654&logintoken=123ABC'
148 =>
'apihelp-clientlogin-example-login2',
153 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Login';
158class_alias( ApiClientLogin::class,
'ApiClientLogin' );
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()