MaxSem has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/80324


Change subject: Deprecate $wgMFForceSecureLogin in favor of core setting
......................................................................

Deprecate $wgMFForceSecureLogin in favor of core setting

Change-Id: If2fd6ae42e58f6824d752b2e8b3b804ae99d450d
---
M MobileFrontend.php
M includes/MobileFrontend.hooks.php
M includes/skins/SkinMinerva.php
M includes/skins/SkinMobile.php
M includes/skins/UserLoginAndCreateTemplate.php
5 files changed, 12 insertions(+), 18 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/24/80324/1

diff --git a/MobileFrontend.php b/MobileFrontend.php
index 0be15c3..5e6fecf 100644
--- a/MobileFrontend.php
+++ b/MobileFrontend.php
@@ -291,12 +291,6 @@
 $wgDeviceDetectionClass = 'DeviceDetection';
 
 /**
- * Will force login-related links to use https if set to true, otherwise
- * login-related links will use whatever protocol is in use by the user
- */
-$wgMFForceSecureLogin = false;
-
-/**
  * Whether geodata related functionality should be enabled
  *
  * Defaults to false.
diff --git a/includes/MobileFrontend.hooks.php 
b/includes/MobileFrontend.hooks.php
index bc2da6b..562a4a1 100644
--- a/includes/MobileFrontend.hooks.php
+++ b/includes/MobileFrontend.hooks.php
@@ -345,7 +345,7 @@
         *
         * We use this hook to ensure that login/account creation pages
         * are redirected to HTTPS if they are not accessed via HTTPS and
-        * $wgMFForceSecureLogin == true - but only when using the
+        * $wgSecureLogin == true - but only when using the
         * mobile site.
         *
         * @param $special SpecialPage
@@ -353,7 +353,7 @@
         * @return bool
         */
        public static function onSpecialPageBeforeExecute( SpecialPage 
$special, $subpage ) {
-               global $wgMFForceSecureLogin;
+               global $wgSecureLogin;
                $mobileContext = MobileContext::singleton();
                $isMobileView = $mobileContext->shouldDisplayMobileView();
                if ( $special->getName() != 'Userlogin' || !$isMobileView ) {
@@ -377,7 +377,7 @@
                // most of this is lifted from https redirect code in 
SpecialUserlogin::execute()
                // also, checking for 'https' in $wgServer is a little funky, 
but this is what
                // is done on the WMF cluster (see config in CommonSettings.php)
-               if ( $wgMFForceSecureLogin && WebRequest::detectProtocol() != 
'https' ) {
+               if ( $wgSecureLogin && WebRequest::detectProtocol() != 'https' 
) {
                        // get the https url and redirect
                        $query = 
$special->getContext()->getRequest()->getQueryValues();
                        if ( isset( $query['title'] ) )  {
diff --git a/includes/skins/SkinMinerva.php b/includes/skins/SkinMinerva.php
index dd16d92..d479132 100644
--- a/includes/skins/SkinMinerva.php
+++ b/includes/skins/SkinMinerva.php
@@ -48,7 +48,7 @@
 
        /**
         * Prepares a url to the Special:UserLogin with query parameters,
-        * taking into account $wgMFForceSecureLogin
+        * taking into account $wgSecureLogin
         * @param array $query
         * @return string
         */
diff --git a/includes/skins/SkinMobile.php b/includes/skins/SkinMobile.php
index 1d70f55..7308939 100644
--- a/includes/skins/SkinMobile.php
+++ b/includes/skins/SkinMobile.php
@@ -313,17 +313,17 @@
 
        /**
         * Prepares a url to the Special:UserLogin with query parameters,
-        * taking into account $wgMFForceSecureLogin
+        * taking into account $wgSecureLogin
         * @param array $query
         * @return string
         */
        public static function getLoginUrl( $query ) {
-               global $wgMFForceSecureLogin;
+               global $wgSecureLogin;
 
-               if ( WebRequest::detectProtocol() != 'https' && 
$wgMFForceSecureLogin ) {
+               if ( WebRequest::detectProtocol() != 'https' && $wgSecureLogin 
) {
                        $ctx = MobileContext::singleton();
                        $loginUrl = SpecialPage::getTitleFor( 'Userlogin' 
)->getFullURL( $query );
-                       return $ctx->getMobileUrl( $loginUrl, 
$wgMFForceSecureLogin );
+                       return $ctx->getMobileUrl( $loginUrl, $wgSecureLogin );
                }
                return SpecialPage::getTitleFor( 'Userlogin' )->getLocalURL( 
$query );
        }
@@ -377,7 +377,7 @@
         * @return Array: Representation of button with text and href keys
        */
        private function getLogInOutLink() {
-               global $wgMFForceSecureLogin;
+               global $wgSecureLogin;
                wfProfileIn( __METHOD__ );
                $context = MobileContext::singleton();
                $query = array();
@@ -393,7 +393,7 @@
                                $query[ 'returntoquery' ] = wfArrayToCgi( 
$returntoquery );
                        }
                        $url = SpecialPage::getTitleFor( 'UserLogout' 
)->getFullURL( $query );
-                       $url = $context->getMobileUrl( $url, 
$wgMFForceSecureLogin );
+                       $url = $context->getMobileUrl( $url, $wgSecureLogin );
                        $text = wfMessage( 'mobile-frontend-main-menu-logout' 
)->escaped();
                } else {
                         // note returnto is not set for mobile (per product 
spec)
diff --git a/includes/skins/UserLoginAndCreateTemplate.php 
b/includes/skins/UserLoginAndCreateTemplate.php
index 1ce2bc8..eacbbd5 100644
--- a/includes/skins/UserLoginAndCreateTemplate.php
+++ b/includes/skins/UserLoginAndCreateTemplate.php
@@ -62,9 +62,9 @@
         * @return bool
         */
        protected function doStickHTTPS() {
-               global $wgMFForceSecureLogin;
+               global $wgSecureLogin;
                $request = $this->getRequestContext()->getRequest();
-               if ( $wgMFForceSecureLogin && $request->detectProtocol() === 
'https' ) {
+               if ( $wgSecureLogin && $request->detectProtocol() === 'https' ) 
{
                        return true;
                }
                return false;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If2fd6ae42e58f6824d752b2e8b3b804ae99d450d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: MaxSem <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to