Revert "API: Remove deprecated response values from action=login"

Revert commit 23e5cdb503
temporarily so Pywikibot users can catch up with API changes

Bug: T121527
Bug: T142155
Change-Id: I3879a5d76a1727dd653daeebc79d4d9cabd0332e
This commit is contained in:
Gergő Tisza 2016-08-05 22:50:11 +00:00
parent 23e5cdb503
commit fda4d48e84
2 changed files with 14 additions and 0 deletions

View file

@ -212,6 +212,15 @@ class ApiLogin extends ApiBase {
$result['lguserid'] = intval( $user->getId() );
$result['lgusername'] = $user->getName();
// @todo: These are deprecated, and should be removed at some
// point (1.28 at the earliest, and see T121527). They were ok
// when the core cookie-based login was the only thing, but
// CentralAuth broke that a while back and
// SessionManager/AuthManager *really* break it.
$result['lgtoken'] = $user->getToken();
$result['cookieprefix'] = $this->getConfig()->get( 'CookiePrefix' );
$result['sessionid'] = $session->getId();
break;
case 'NeedToken':
@ -219,6 +228,10 @@ class ApiLogin extends ApiBase {
$this->setWarning( 'Fetching a token via action=login is deprecated. ' .
'Use action=query&meta=tokens&type=login instead.' );
$this->logFeatureUsage( 'action=login&!lgtoken' );
// @todo: See above about deprecation
$result['cookieprefix'] = $this->getConfig()->get( 'CookiePrefix' );
$result['sessionid'] = $session->getId();
break;
case 'WrongToken':

View file

@ -190,6 +190,7 @@ class ApiLoginTest extends ApiTestCase {
$this->assertArrayHasKey( "login", $data[0] );
$this->assertArrayHasKey( "result", $data[0]['login'] );
$this->assertEquals( "Success", $data[0]['login']['result'] );
$this->assertArrayHasKey( 'lgtoken', $data[0]['login'] );
}
public function testBotPassword() {