From 74756a24091d3b875a2fbf8759d8688609727586 Mon Sep 17 00:00:00 2001 From: tonythomas01 <01tonythomas@gmail.com> Date: Sun, 10 Nov 2013 20:08:34 +0530 Subject: [PATCH] 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 Change-Id: I7c957e1e1aaecf47f7c47bc063b5d3b364644afc --- RELEASE-NOTES-1.23 | 1 + includes/DefaultSettings.php | 1 - includes/Preferences.php | 8 -------- includes/User.php | 21 ++++++++++----------- includes/api/ApiLogin.php | 1 - includes/specials/SpecialUserlogin.php | 14 ++++---------- languages/i18n/en.json | 1 - maintenance/dictionary/mediawiki.dic | 1 - maintenance/language/messages.inc | 1 - 9 files changed, 15 insertions(+), 34 deletions(-) diff --git a/RELEASE-NOTES-1.23 b/RELEASE-NOTES-1.23 index d0a8ec7d6b..222871a8ae 100644 --- a/RELEASE-NOTES-1.23 +++ b/RELEASE-NOTES-1.23 @@ -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) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 663098f91b..6c6c3f0a06 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -4076,7 +4076,6 @@ $wgDefaultUserOptions = array( '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 1825cceab7..661d2c621a 100644 --- a/includes/Preferences.php +++ b/includes/Preferences.php @@ -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( diff --git a/includes/User.php b/includes/User.php index 1ccb732637..fd10e9af7c 100644 --- a/includes/User.php +++ b/includes/User.php @@ -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__ ); } diff --git a/includes/api/ApiLogin.php b/includes/api/ApiLogin.php index cba2134568..f2a9d1a1ab 100644 --- a/includes/api/ApiLogin.php +++ b/includes/api/ApiLogin.php @@ -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(); diff --git a/includes/specials/SpecialUserlogin.php b/includes/specials/SpecialUserlogin.php index b049975e3e..9a2e194b99 100644 --- a/includes/specials/SpecialUserlogin.php +++ b/includes/specials/SpecialUserlogin.php @@ -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() ); diff --git a/languages/i18n/en.json b/languages/i18n/en.json index 41c12b368c..d94cd30ae0 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 5656d82e5a..bf13c38050 100644 --- a/maintenance/dictionary/mediawiki.dic +++ b/maintenance/dictionary/mediawiki.dic @@ -3370,7 +3370,6 @@ relname relnamespace remarticle remembermypassword -rememberpassword removablegroups removal remove diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index 31d753c69c..a88d1ba197 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -37,7 +37,6 @@ $wgMessageStructure = array( 'tog-showtoolbar', 'tog-editondblclick', 'tog-editsectiononrightclick', - 'tog-rememberpassword', 'tog-watchcreations', 'tog-watchdefault', 'tog-watchmoves', -- 2.20.1