r100140 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100139‎ | r100140 | r100141 >
Date:18:07, 18 October 2011
Author:ialex
Status:ok
Tags:
Comment:
Fix for r100114: make API and tests work again
Modified paths:
  • /trunk/phase3/includes/api/ApiLogin.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialUserlogin.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiLogin.php
@@ -68,7 +68,10 @@
6969 wfSetupSession();
7070 }
7171
72 - $loginForm = new LoginForm( $req );
 72+ $context = $this->createContext();
 73+ $context->setRequest( $req );
 74+ $loginForm = new LoginForm();
 75+ $loginForm->setContext( $context );
7376
7477 global $wgCookiePrefix, $wgUser, $wgPasswordAttemptThrottle;
7578
Index: trunk/phase3/includes/specials/SpecialUserlogin.php
@@ -49,6 +49,7 @@
5050 var $mSkipCookieCheck, $mReturnToQuery, $mToken, $mStickHTTPS;
5151 var $mType, $mReason, $mRealName;
5252 var $mAbortLoginErrorMsg = 'login-abort-generic';
 53+ private $mLoaded = false;
5354
5455 /**
5556 * @var ExternalUser
@@ -74,9 +75,20 @@
7576 *
7677 * @param $request WebRequest object
7778 */
78 - function load( $request ) {
 79+ function load() {
7980 global $wgAuth, $wgHiddenPrefs, $wgEnableEmail, $wgRedirectOnLogin;
8081
 82+ if ( $this->mLoaded ) {
 83+ return;
 84+ }
 85+ $this->mLoaded = true;
 86+
 87+ if ( $this->mOverrideRequest === null ) {
 88+ $request = $this->getRequest();
 89+ } else {
 90+ $request = $this->mOverrideRequest;
 91+ }
 92+
8193 $this->mType = $request->getText( 'type' );
8294 $this->mUsername = $request->getText( 'wpName' );
8395 $this->mPassword = $request->getText( 'wpPassword' );
@@ -132,12 +144,7 @@
133145 wfSetupSession();
134146 }
135147
136 - if ( $this->mOverrideRequest === null ) {
137 - $request = $this->getRequest();
138 - } else {
139 - $request = $this->mOverrideRequest;
140 - }
141 - $this->load( $request );
 148+ $this->load();
142149
143150 if ( $par == 'signup' ) { # Check for [[Special:Userlogin/signup]]
144151 $this->mType = 'signup';
@@ -459,6 +466,8 @@
460467 public function authenticateUserData() {
461468 global $wgUser, $wgAuth;
462469
 470+ $this->load();
 471+
463472 if ( $this->mUsername == '' ) {
464473 return self::NO_NAME;
465474 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r100114* Use local context instead of global variables...ialex14:08, 18 October 2011

Status & tagging log