If a user logs in while not on https, then the user should be sent back to the non...
authorStephen Liang <github@stephenliang.pw>
Sun, 5 Oct 2014 23:19:14 +0000 (18:19 -0500)
committerStephen Liang <wikimedia@stephenliang.pw>
Wed, 19 Nov 2014 15:18:04 +0000 (09:18 -0600)
Bug: 71716
Change-Id: I7c24b779e5f4b01bd400a1833e12932f7b01f848

includes/specials/SpecialUserlogin.php
includes/templates/Userlogin.php

index bdd6751..3441f7a 100644 (file)
@@ -145,7 +145,8 @@ class LoginForm extends SpecialPage {
                $this->mLoginattempt = $request->getCheck( 'wpLoginattempt' );
                $this->mAction = $request->getVal( 'action' );
                $this->mRemember = $request->getCheck( 'wpRemember' );
-               $this->mFromHTTP = $request->getBool( 'fromhttp', false );
+               $this->mFromHTTP = $request->getBool( 'fromhttp', false )
+                       || $request->getBool( 'wpFromhttp', false );
                $this->mStickHTTPS = ( !$this->mFromHTTP && $request->getProtocol() === 'https' )
                        || $request->getBool( 'wpForceHttps', false );
                $this->mLanguage = $request->getText( 'uselang' );
@@ -1435,6 +1436,11 @@ class LoginForm extends SpecialPage {
                        $template->set( 'signupend', $this->msg( 'signupend' )->parse() );
                }
 
+               // If using HTTPS coming from HTTP, then the 'fromhttp' parameter must be preserved
+               if ( $usingHTTPS ) {
+                       $template->set( 'fromhttp', $this->mFromHTTP );
+               }
+
                // Give authentication and captcha plugins a chance to modify the form
                $wgAuth->modifyUITemplate( $template, $this->mType );
                if ( $this->mType == 'signup' ) {
index 99fe218..fd16552 100644 (file)
@@ -187,6 +187,7 @@ class UserloginTemplate extends BaseTemplate {
                        <?php if ( $this->haveData( 'uselang' ) ) { ?><input type="hidden" name="uselang" value="<?php $this->text( 'uselang' ); ?>" /><?php } ?>
                        <?php if ( $this->haveData( 'token' ) ) { ?><input type="hidden" name="wpLoginToken" value="<?php $this->text( 'token' ); ?>" /><?php } ?>
                        <?php if ( $this->data['cansecurelogin'] ) {?><input type="hidden" name="wpForceHttps" value="<?php $this->text( 'stickhttps' ); ?>" /><?php } ?>
+                       <?php if ( $this->data['cansecurelogin'] && $this->haveData( 'fromhttp' )) {?><input type="hidden" name="wpFromhttp" value="<?php $this->text( 'fromhttp' ); ?>" /><?php } ?>
                </form>
        </div>
 </div>