From 8c257d756bbcd4bd8596d35c5fa158c4e80cd711 Mon Sep 17 00:00:00 2001 From: Raimond Spekking Date: Mon, 14 Jun 2010 18:28:39 +0000 Subject: [PATCH] * Show validity period of the login cookie in Special:UserLogin and Special:Preferences * Ask for permanent login in Special:Preferences only if $wgCookieExpiration > 0 --- RELEASE-NOTES | 3 +++ includes/Preferences.php | 18 ++++++++++------ includes/specials/SpecialResetpass.php | 4 +++- includes/templates/Userlogin.php | 30 ++++++++++++++++---------- languages/messages/MessagesEn.php | 4 ++-- 5 files changed, 39 insertions(+), 20 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 69642c47e3..35520832ff 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -80,6 +80,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 21312) RevisionMove allows moving individual revisions of a page to another page. Introducing 'revisionmove' user right; disabled by default; experimental feature. +* Show validity period of the login cookie in Special:UserLogin and + Special:Preferences === Bug fixes in 1.17 === * (bug 17560) Half-broken deletion moved image files to deletion archive @@ -193,6 +195,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 23747) Make sure that on History pages, the RevDel button is not accidently activated when hitting enter. * (bug 23845) Special:ListFiles now uses correct file names without underscores +* Ask for permanent login in Special:Preferences only if $wgCookieExpiration > 0 === API changes in 1.17 === * (bug 22738) Allow filtering by action type on query=logevent. diff --git a/includes/Preferences.php b/includes/Preferences.php index 802db5acb3..d8891849d5 100644 --- a/includes/Preferences.php +++ b/includes/Preferences.php @@ -217,12 +217,18 @@ class Preferences { 'section' => 'personal/info', ); } - - $defaultPreferences['rememberpassword'] = array( - 'type' => 'toggle', - 'label-message' => 'tog-rememberpassword', - 'section' => 'personal/info', - ); + global $wgCookieExpiration; + if ( $wgCookieExpiration > 0 ) { + $defaultPreferences['rememberpassword'] = array( + 'type' => 'toggle', + 'label' => wfMsgExt( + 'tog-rememberpassword', + array( 'parsemag' ), + $wgLang->formatNum( ceil( $wgCookieExpiration / ( 3600 * 24 ) ) ) + ), + 'section' => 'personal/info', + ); + } // Language global $wgContLanguageCode; diff --git a/includes/specials/SpecialResetpass.php b/includes/specials/SpecialResetpass.php index e4bc54f5b5..346e0f0f25 100644 --- a/includes/specials/SpecialResetpass.php +++ b/includes/specials/SpecialResetpass.php @@ -96,10 +96,12 @@ class SpecialResetpass extends SpecialPage { } $rememberMe = ''; if ( !$wgUser->isLoggedIn() ) { + global $wgCookieExpiration, $wgLang; $rememberMe = '' . '' . '' . - Xml::checkLabel( wfMsg( 'remembermypassword' ), + Xml::checkLabel( + wfMsgExt( 'remembermypassword', 'parsemag', $wgLang->formatNum( ceil( $wgCookieExpiration / ( 3600 * 24 ) ) ) ), 'wpRemember', 'wpRemember', $wgRequest->getCheck( 'wpRemember' ) ) . '' . diff --git a/includes/templates/Userlogin.php b/includes/templates/Userlogin.php index 8989bc1afa..c6a8ced41c 100644 --- a/includes/templates/Userlogin.php +++ b/includes/templates/Userlogin.php @@ -82,12 +82,15 @@ class UserloginTemplate extends QuickTemplate { '4', - 'id' => 'wpRemember' - ) + ( $this->data['remember'] ? array( 'checked' ) : array() ) ); ?> - - + global $wgCookieExpiration, $wgLang; + echo Xml::checkLabel( + wfMsgExt( 'remembermypassword', 'parsemag', $wgLang->formatNum( ceil( $wgCookieExpiration / ( 3600 * 24 ) ) ) ), + 'wpRemember', + 'wpRemember', + $this->data['remember'], + array( 'tabindex' => '4' ) + ) + ?> @@ -245,11 +248,16 @@ class UsercreateTemplate extends QuickTemplate { - data['remember'] ) { ?>checked="checked" - /> + formatNum( ceil( $wgCookieExpiration / ( 3600 * 24 ) ) ) ), + 'wpRemember', + 'wpRemember', + $this->data['remember'], + array( 'tabindex' => '7' ) + ) + ?> 'Enable section editing via [edit] links', 'tog-editsectiononrightclick' => 'Enable section editing by right clicking on section titles (requires JavaScript)', 'tog-showtoc' => 'Show table of contents (for pages with more than 3 headings)', -'tog-rememberpassword' => 'Remember my login on this computer', +'tog-rememberpassword' => 'Remember my login on this computer (for a maximum of $1 {{PLURAL:$1|day|days}})', 'tog-watchcreations' => 'Add pages I create to my watchlist', 'tog-watchdefault' => 'Add pages I edit to my watchlist', 'tog-watchmoves' => 'Add pages I move to my watchlist', @@ -1043,7 +1043,7 @@ Do not forget to change your [[Special:Preferences|{{SITENAME}} preferences]].', 'yourname' => 'Username:', 'yourpassword' => 'Password:', 'yourpasswordagain' => 'Retype password:', -'remembermypassword' => 'Remember my login on this computer', +'remembermypassword' => 'Remember my login on this computer (for a maximum of $1 {{PLURAL:$1|day|days}})', 'yourdomainname' => 'Your domain:', 'externaldberror' => 'There was either an authentication database error or you are not allowed to update your external account.', 'login' => 'Log in', -- 2.20.1