Merge "By default, keep users in HTTPS with wgSecureLogin"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 6 Feb 2013 15:15:16 +0000 (15:15 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 6 Feb 2013 15:15:16 +0000 (15:15 +0000)
includes/DefaultSettings.php
includes/specials/SpecialUserlogin.php

index 68c4542..be441e8 100644 (file)
@@ -3770,6 +3770,13 @@ $wgAllowPrefChange = array();
  */
 $wgSecureLogin = false;
 
+/**
+ * By default, keep users logged in via HTTPS when $wgSecureLogin is also
+ * true. Users opt-out of HTTPS when they login by de-selecting the checkbox.
+ * @since 1.21
+ */
+$wgSecureLoginDefaultHTTPS = true;
+
 /** @} */ # end user accounts }
 
 /************************************************************************//**
index e57871c..63d101b 100644 (file)
@@ -1011,7 +1011,7 @@ class LoginForm extends SpecialPage {
                global $wgEnableEmail, $wgEnableUserEmail;
                global $wgHiddenPrefs, $wgLoginLanguageSelector;
                global $wgAuth, $wgEmailConfirmToEdit, $wgCookieExpiration;
-               global $wgSecureLogin, $wgPasswordResetRoutes;
+               global $wgSecureLogin, $wgSecureLoginDefaultHTTPS, $wgPasswordResetRoutes;
 
                $titleObj = $this->getTitle();
                $user = $this->getUser();
@@ -1076,6 +1076,11 @@ class LoginForm extends SpecialPage {
                        $template->set( 'link', '' );
                }
 
+               // Decide if we default stickHTTPS on
+               if ( $wgSecureLoginDefaultHTTPS && $this->mAction != 'submitlogin' && !$this->mLoginattempt ) {
+                       $this->mStickHTTPS = true;
+               }
+
                $resetLink = $this->mType == 'signup'
                        ? null
                        : is_array( $wgPasswordResetRoutes ) && in_array( true, array_values( $wgPasswordResetRoutes ) );