Krinkle has uploaded a new change for review.

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

Change subject: Removed 'Remember my login' preference
......................................................................

Removed 'Remember my login' preference

Removed 'Remember my login' from Preferences, as it was unwanted. It adds
to the complexity of the user preferences

Bug: 52342
Co-Author: Tyler Romeo <tylerro...@gmail.com>
Change-Id: I7c957e1e1aaecf47f7c47bc063b5d3b364644afc
(cherry picked from commit 74756a24091d3b875a2fbf8759d8688609727586)
---
M RELEASE-NOTES-1.23
M includes/DefaultSettings.php
M includes/Preferences.php
M includes/User.php
M includes/api/ApiLogin.php
M includes/specials/SpecialUserlogin.php
M languages/i18n/en.json
M maintenance/dictionary/mediawiki.dic
M maintenance/language/messages.inc
9 files changed, 15 insertions(+), 34 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/15/134615/1

diff --git a/RELEASE-NOTES-1.23 b/RELEASE-NOTES-1.23
index 831daeb..974d546 100644
--- a/RELEASE-NOTES-1.23
+++ b/RELEASE-NOTES-1.23
@@ -361,6 +361,7 @@
   scope (like Zepto.js or document.querySelectorAll, for example) you will need
   to use different names to or re-bind them at the top of each
   ResourceLoader-loaded module.
+* (bug 52342) Preference "Remember my login" was removed.
 
 ==== Removed classes ====
 * FakeMemCachedClient (deprecated in 1.18)
diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index 96fc113..8cda45b 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -4075,7 +4075,6 @@
        'previewontop' => 1,
        'rcdays' => 7,
        'rclimit' => 50,
-       'rememberpassword' => 0,
        'rows' => 25,
        'showhiddencats' => 0,
        'shownumberswatching' => 1,
diff --git a/includes/Preferences.php b/includes/Preferences.php
index 1825cce..661d2c6 100644
--- a/includes/Preferences.php
+++ b/includes/Preferences.php
@@ -301,14 +301,6 @@
                                'section' => 'personal/info',
                        );
                }
-               if ( $wgCookieExpiration > 0 ) {
-                       $defaultPreferences['rememberpassword'] = array(
-                               'type' => 'toggle',
-                               'label' => $context->msg( 
'tog-rememberpassword' )->numParams(
-                                       ceil( $wgCookieExpiration / ( 3600 * 24 
) ) )->text(),
-                               'section' => 'personal/info',
-                       );
-               }
                // Only show prefershttps if secure login is turned on
                if ( $wgSecureLogin && wfCanIPUseHTTPS( 
$context->getRequest()->getIP() ) ) {
                        $defaultPreferences['prefershttps'] = array(
diff --git a/includes/User.php b/includes/User.php
index 1ccb732..fd10e9a 100644
--- a/includes/User.php
+++ b/includes/User.php
@@ -3319,8 +3319,9 @@
         * @param $request WebRequest object to use; $wgRequest will be used if 
null
         *        is passed.
         * @param bool $secure Whether to force secure/insecure cookies or use 
default
+        * @param bool $rememberMe Whether to add a Token cookie for elongated 
sessions
         */
-       public function setCookies( $request = null, $secure = null ) {
+       public function setCookies( $request = null, $secure = null, 
$rememberMe = false ) {
                if ( $request === null ) {
                        $request = $this->getRequest();
                }
@@ -3346,7 +3347,7 @@
                        'UserID' => $this->mId,
                        'UserName' => $this->getName(),
                );
-               if ( 1 == $this->getOption( 'rememberpassword' ) ) {
+               if ( $rememberMe ) {
                        $cookies['Token'] = $this->mToken;
                } else {
                        $cookies['Token'] = false;
@@ -3373,14 +3374,10 @@
                 * standard time setting, based on if rememberme was set.
                 */
                if ( $request->getCheck( 'wpStickHTTPS' ) || 
$this->requiresHTTPS() ) {
-                       $time = null;
-                       if ( ( 1 == $this->getOption( 'rememberpassword' ) ) ) {
-                               $time = 0; // set to $wgCookieExpiration
-                       }
                        $this->setCookie(
                                'forceHTTPS',
                                'true',
-                               $time,
+                               $rememberMe ? 0 : null,
                                false,
                                array( 'prefix' => '' ) // no prefix
                        );
@@ -4786,11 +4783,13 @@
                        $priorKeys[] = $row->up_property;
                }
                if ( count( $priorKeys ) ) {
-                       // Do the DELETE by PRIMARY KEY for prior rows. A very 
large portion of
-                       // calls to this function are for setting 
'rememberpassword' for new accounts.
+                       // Do the DELETE by PRIMARY KEY for prior rows.
+                       // In the past a very large portion of calls to this 
function are for setting
+                       // 'rememberpassword' for new accounts (a preference 
that has since been removed).
                        // Doing a blanket per-user DELETE for new accounts 
with no rows in the table
-                       // causes gap locks on [max user ID,+infinity) which 
causes high contention since
-                       // updates will pile up on each other as they are for 
higher (newer) user IDs.
+                       // caused gap locks on [max user ID,+infinity) which 
caused high contention since
+                       // updates would pile up on each other as they are for 
higher (newer) user IDs.
+                       // It might not be necessary these days, but it 
shouldn't hurt either.
                        $dbw->delete( 'user_properties',
                                array( 'up_user' => $userId, 'up_property' => 
$priorKeys ), __METHOD__ );
                }
diff --git a/includes/api/ApiLogin.php b/includes/api/ApiLogin.php
index cba2134..f2a9d1a 100644
--- a/includes/api/ApiLogin.php
+++ b/includes/api/ApiLogin.php
@@ -86,7 +86,6 @@
                        case LoginForm::SUCCESS:
                                $user = $context->getUser();
                                $this->getContext()->setUser( $user );
-                               $user->setOption( 'rememberpassword', 1 );
                                $user->setCookies( $this->getRequest() );
 
                                ApiQueryInfo::resetTokenCache();
diff --git a/includes/specials/SpecialUserlogin.php 
b/includes/specials/SpecialUserlogin.php
index b049975..9a2e194 100644
--- a/includes/specials/SpecialUserlogin.php
+++ b/includes/specials/SpecialUserlogin.php
@@ -559,7 +559,6 @@
 
                $wgAuth->initUser( $u, $autocreate );
 
-               $u->setOption( 'rememberpassword', $this->mRemember ? 1 : 0 );
                $u->saveSettings();
 
                // Update user count
@@ -822,21 +821,16 @@
                        case self::SUCCESS:
                                # We've verified now, update the real record
                                $user = $this->getUser();
-                               if ( (bool)$this->mRemember != 
$user->getBoolOption( 'rememberpassword' ) ) {
-                                       $user->setOption( 'rememberpassword', 
$this->mRemember ? 1 : 0 );
-                                       $user->saveSettings();
-                               } else {
-                                       $user->invalidateCache();
-                               }
+                               $user->invalidateCache();
 
                                if ( $user->requiresHTTPS() ) {
                                        $this->mStickHTTPS = true;
                                }
 
                                if ( $wgSecureLogin && !$this->mStickHTTPS ) {
-                                       $user->setCookies( null, false );
+                                       $user->setCookies( $this->mRequest, 
false, $this->mRemember );
                                } else {
-                                       $user->setCookies();
+                                       $user->setCookies( $this->mRequest, 
null, $this->mRemember );
                                }
                                self::clearLoginToken();
 
@@ -1291,7 +1285,7 @@
                $template->set( 'resetlink', $resetLink );
                $template->set( 'canremember', ( $wgCookieExpiration > 0 ) );
                $template->set( 'usereason', $user->isLoggedIn() );
-               $template->set( 'remember', $user->getOption( 
'rememberpassword' ) || $this->mRemember );
+               $template->set( 'remember', $this->mRemember );
                $template->set( 'cansecurelogin', ( $wgSecureLogin === true ) );
                $template->set( 'stickhttps', (int)$this->mStickHTTPS );
                $template->set( 'loggedin', $user->isLoggedIn() );
diff --git a/languages/i18n/en.json b/languages/i18n/en.json
index 34fe4d5..639badb 100644
--- a/languages/i18n/en.json
+++ b/languages/i18n/en.json
@@ -13,7 +13,6 @@
     "tog-showtoolbar": "Show edit toolbar",
     "tog-editondblclick": "Edit pages on double click",
     "tog-editsectiononrightclick": "Enable section editing by right clicking 
on section titles",
-    "tog-rememberpassword": "Remember my login on this browser (for a maximum 
of $1 {{PLURAL:$1|day|days}})",
     "tog-watchcreations": "Add pages I create and files I upload to my 
watchlist",
     "tog-watchdefault": "Add pages and files I edit to my watchlist",
     "tog-watchmoves": "Add pages and files I move to my watchlist",
diff --git a/maintenance/dictionary/mediawiki.dic 
b/maintenance/dictionary/mediawiki.dic
index 5656d82..bf13c38 100644
--- a/maintenance/dictionary/mediawiki.dic
+++ b/maintenance/dictionary/mediawiki.dic
@@ -3370,7 +3370,6 @@
 relnamespace
 remarticle
 remembermypassword
-rememberpassword
 removablegroups
 removal
 remove
diff --git a/maintenance/language/messages.inc 
b/maintenance/language/messages.inc
index 31d753c..a88d1ba 100644
--- a/maintenance/language/messages.inc
+++ b/maintenance/language/messages.inc
@@ -37,7 +37,6 @@
                'tog-showtoolbar',
                'tog-editondblclick',
                'tog-editsectiononrightclick',
-               'tog-rememberpassword',
                'tog-watchcreations',
                'tog-watchdefault',
                'tog-watchmoves',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7c957e1e1aaecf47f7c47bc063b5d3b364644afc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: REL1_23
Gerrit-Owner: Krinkle <krinklem...@gmail.com>
Gerrit-Reviewer: 01tonythomas <01tonytho...@gmail.com>

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

Reply via email to