From cf40d9023da5b3dbdf1d4b9c833ae0e0c2cff84f Mon Sep 17 00:00:00 2001 From: Bryan Tong Minh Date: Thu, 29 May 2008 18:57:06 +0000 Subject: [PATCH] (bug 14335) Use proper $wgUser methods instead of using $_SESSION --- RELEASE-NOTES | 1 + includes/User.php | 6 ++++++ includes/api/ApiLogin.php | 6 +++--- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 9355d36c18..877a195470 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -383,6 +383,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 14243) Only accept post requests in action=edit; patch by HardDisk * action=block now returns an ISO8601 timestamp, like all other modules do * Added md5 parameter to action=edit +* (bug 14335) Use proper $wgUser methods instead of using $_SESSION === Languages updated in 1.13 === diff --git a/includes/User.php b/includes/User.php index 77dce0b7c1..5a36eea029 100644 --- a/includes/User.php +++ b/includes/User.php @@ -1578,6 +1578,12 @@ class User { $this->mNewpassword = ''; $this->mNewpassTime = null; } + + function getToken() { + $this->load(); + return $this->mToken; + } + /** * Set the random token (used for persistent authentication) * Called from loadDefaults() among other places. diff --git a/includes/api/ApiLogin.php b/includes/api/ApiLogin.php index 0b216000a3..525ec2d9e7 100644 --- a/includes/api/ApiLogin.php +++ b/includes/api/ApiLogin.php @@ -105,9 +105,9 @@ class ApiLogin extends ApiBase { $wgUser->setCookies(); $result['result'] = 'Success'; - $result['lguserid'] = $_SESSION['wsUserID']; - $result['lgusername'] = $_SESSION['wsUserName']; - $result['lgtoken'] = $_SESSION['wsToken']; + $result['lguserid'] = $wgUser->getId(); + $result['lgusername'] = $wgUser->getName(); + $result['lgtoken'] = $wgUser->getToken(); $result['cookieprefix'] = $wgCookiePrefix; $result['sessionid'] = session_id(); break; -- 2.20.1