Removed 'Remember my login' preference
authortonythomas01 <01tonythomas@gmail.com>
Sun, 10 Nov 2013 14:38:34 +0000 (20:08 +0530)
committerTony Thomas <01tonythomas@gmail.com>
Wed, 16 Apr 2014 07:19:44 +0000 (12:49 +0530)
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 <tylerromeo@gmail.com>
Change-Id: I7c957e1e1aaecf47f7c47bc063b5d3b364644afc

RELEASE-NOTES-1.23
includes/DefaultSettings.php
includes/Preferences.php
includes/User.php
includes/api/ApiLogin.php
includes/specials/SpecialUserlogin.php
languages/i18n/en.json
maintenance/dictionary/mediawiki.dic
maintenance/language/messages.inc

index d0a8ec7..222871a 100644 (file)
@@ -348,6 +348,7 @@ changes to languages because of Bugzilla reports.
   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)
index 663098f..6c6c3f0 100644 (file)
@@ -4076,7 +4076,6 @@ $wgDefaultUserOptions = array(
        'previewontop' => 1,
        'rcdays' => 7,
        'rclimit' => 50,
-       'rememberpassword' => 0,
        'rows' => 25,
        'showhiddencats' => 0,
        'shownumberswatching' => 1,
index 1825cce..661d2c6 100644 (file)
@@ -301,14 +301,6 @@ class Preferences {
                                '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(
index 1ccb732..fd10e9a 100644 (file)
@@ -3319,8 +3319,9 @@ class User {
         * @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 @@ class User {
                        '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 @@ class User {
                 * 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 @@ class User {
                        $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__ );
                }
index cba2134..f2a9d1a 100644 (file)
@@ -86,7 +86,6 @@ class ApiLogin extends ApiBase {
                        case LoginForm::SUCCESS:
                                $user = $context->getUser();
                                $this->getContext()->setUser( $user );
-                               $user->setOption( 'rememberpassword', 1 );
                                $user->setCookies( $this->getRequest() );
 
                                ApiQueryInfo::resetTokenCache();
index b049975..9a2e194 100644 (file)
@@ -559,7 +559,6 @@ class LoginForm extends SpecialPage {
 
                $wgAuth->initUser( $u, $autocreate );
 
-               $u->setOption( 'rememberpassword', $this->mRemember ? 1 : 0 );
                $u->saveSettings();
 
                // Update user count
@@ -822,21 +821,16 @@ class LoginForm extends SpecialPage {
                        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 @@ class LoginForm extends SpecialPage {
                $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() );
index 41c12b3..d94cd30 100644 (file)
@@ -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",
index 5656d82..bf13c38 100644 (file)
@@ -3370,7 +3370,6 @@ relname
 relnamespace
 remarticle
 remembermypassword
-rememberpassword
 removablegroups
 removal
 remove
index 31d753c..a88d1ba 100644 (file)
@@ -37,7 +37,6 @@ $wgMessageStructure = array(
                'tog-showtoolbar',
                'tog-editondblclick',
                'tog-editsectiononrightclick',
-               'tog-rememberpassword',
                'tog-watchcreations',
                'tog-watchdefault',
                'tog-watchmoves',