jenkins-bot has submitted this change and it was merged.

Change subject: LoginSignupSpecialPage: Load return and returnto params as 
early as possible
......................................................................


LoginSignupSpecialPage: Load return and returnto params as early as possible

They're are needed for a redirect to the target page after
a successful login, which is made before the SpecialPage::execute()
function is called. Loading basic request varaibles in the execute()
function is therefore too late to take effect for the redirect after
a successul authentication with a primary provider, which needs to
redirect the user to another site.

Bug: T135924
Change-Id: I6ded7f9bb255cbb332a5810e7ed3cb3ecfdb2c04
---
M includes/specialpage/LoginSignupSpecialPage.php
1 file changed, 34 insertions(+), 10 deletions(-)

Approvals:
  Gergő Tisza: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/specialpage/LoginSignupSpecialPage.php 
b/includes/specialpage/LoginSignupSpecialPage.php
index 0e4252c..a7de0c5 100644
--- a/includes/specialpage/LoginSignupSpecialPage.php
+++ b/includes/specialpage/LoginSignupSpecialPage.php
@@ -47,6 +47,7 @@
        protected $mEntryErrorType = 'error';
 
        protected $mLoaded = false;
+       protected $mLoadedRequest = false;
        protected $mSecureLoginUrl;
 
        /** @var string */
@@ -89,19 +90,20 @@
                $wgUseMediaWikiUIEverywhere = true;
        }
 
-       /**
-        * Load data from request.
-        * @private
-        * @param string $subPage Subpage of Special:Userlogin
-        */
-       protected function load( $subPage ) {
-               global $wgSecureLogin;
+       protected function setRequest( array $data, $wasPosted = null ) {
+               parent::setRequest( $data, $wasPosted );
+               $this->mLoadedRequest = false;
+       }
 
-               if ( $this->mLoaded ) {
+       /**
+        * Load basic request parameters for this Special page.
+        * @param $subPage
+        */
+       private function loadRequestParameters( $subPage ) {
+               if ( $this->mLoadedRequest ) {
                        return;
                }
-               $this->mLoaded = true;
-
+               $this->mLoadedRequest = true;
                $request = $this->getRequest();
 
                $this->mPosted = $request->wasPosted();
@@ -114,6 +116,22 @@
                $this->mLanguage = $request->getText( 'uselang' );
                $this->mReturnTo = $request->getVal( 'returnto', '' );
                $this->mReturnToQuery = $request->getVal( 'returntoquery', '' );
+       }
+
+       /**
+        * Load data from request.
+        * @private
+        * @param string $subPage Subpage of Special:Userlogin
+        */
+       protected function load( $subPage ) {
+               global $wgSecureLogin;
+
+               $this->loadRequestParameters( $subPage );
+               if ( $this->mLoaded ) {
+                       return;
+               }
+               $this->mLoaded = true;
+               $request = $this->getRequest();
 
                $securityLevel = $this->getRequest()->getText( 'force' );
                if (
@@ -185,6 +203,12 @@
                return $params;
        }
 
+       protected function beforeExecute( $subPage ) {
+               // finish initializing the class before processing the request 
- T135924
+               $this->loadRequestParameters( $subPage );
+               return parent::beforeExecute( $subPage );
+       }
+
        /**
         * @param string|null $subPage
         */

-- 
To view, visit https://gerrit.wikimedia.org/r/290048
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I6ded7f9bb255cbb332a5810e7ed3cb3ecfdb2c04
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com>
Gerrit-Reviewer: Anomie <bjor...@wikimedia.org>
Gerrit-Reviewer: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com>
Gerrit-Reviewer: Gergő Tisza <gti...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to