r45503 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r45502‎ | r45503 | r45504 >
Date:14:34, 7 January 2009
Author:demon
Status:ok (Comments)
Tags:
Comment:
Re-fix bug 2242 - adding expiry time for temporary passwords. Now with proper global declarations in User :)
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/User.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialUserlogin.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/User.php
@@ -2705,7 +2705,14 @@
27062706 * @return \bool True if matches, false otherwise
27072707 */
27082708 function checkTemporaryPassword( $plaintext ) {
2709 - return self::comparePasswords( $this->mNewpassword, $plaintext, $this->getId() );
 2709+ global $wgNewPasswordExpiry;
 2710+ if( self::comparePasswords( $this->mNewpassword, $plaintext, $this->getId() ) ) {
 2711+ $this->load();
 2712+ $expiry = wfTimestamp( TS_UNIX, $this->mNewpassTime ) + $wgNewPasswordExpiry;
 2713+ return ( time() < $expiry );
 2714+ } else {
 2715+ return false;
 2716+ }
27102717 }
27112718
27122719 /**
Index: trunk/phase3/includes/DefaultSettings.php
@@ -521,6 +521,11 @@
522522 $wgPasswordReminderResendTime = 24;
523523
524524 /**
 525+ * The time, in seconds, when an emailed temporary password expires.
 526+ */
 527+$wgNewPasswordExpiry = 3600 * 24 * 7;
 528+
 529+/**
525530 * SMTP Mode
526531 * For using a direct (authenticated) SMTP server connection.
527532 * Default to false or fill an array :
Index: trunk/phase3/includes/specials/SpecialUserlogin.php
@@ -654,7 +654,7 @@
655655 * @private
656656 */
657657 function mailPasswordInternal( $u, $throttle = true, $emailTitle = 'passwordremindertitle', $emailText = 'passwordremindertext' ) {
658 - global $wgServer, $wgScript, $wgUser;
 658+ global $wgServer, $wgScript, $wgUser, $wgNewPasswordExpiry;
659659
660660 if ( '' == $u->getEmail() ) {
661661 return new WikiError( wfMsg( 'noemail', $u->getName() ) );
@@ -670,7 +670,8 @@
671671 $u->setNewpassword( $np, $throttle );
672672 $u->saveSettings();
673673
674 - $m = wfMsg( $emailText, $ip, $u->getName(), $np, $wgServer . $wgScript );
 674+ $m = wfMsgExt( $emailText, array( 'parsemag' ), $ip, $u->getName(), $np,
 675+ $wgServer . $wgScript, round( $wgNewPasswordExpiry / 86400 ) );
675676 $result = $u->sendMail( wfMsg( $emailTitle ), $m );
676677
677678 return $result;
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -937,6 +937,7 @@
938938 password for {{SITENAME}} ($4). A temporary password for user
939939 "$2" has been created and was set to "$3". If this was your
940940 intent, you will need to log in and choose a new password now.
 941+Your temporary password will expire in {{PLURAL:$5|one day|$5 days}}.
941942
942943 If someone else made this request, or if you have remembered your password,
943944 and you no longer wish to change it, you may ignore this message and
Index: trunk/phase3/RELEASE-NOTES
@@ -71,8 +71,9 @@
7272 * The 'BeforeWatchlist' hook has been removed due to internal changes in
7373 Special:Watchlist. 'SpecialWatchlistQuery' should now be used by extensions
7474 to customize the watchlist database query.
 75+* Added $wgNewPasswordExpiry, to specify an expiry time (in seconds) to
 76+ tempoary passwords
7577
76 -
7778 === Migrated extensions ===
7879 The following extensions are migrated into MediaWiki 1.14:
7980
@@ -257,6 +258,7 @@
258259 move log
259260 * Image moving is now enabled for sysops by default
260261 * Make "Did you mean" search feature more noticeable
 262+* (bug 2242) Add an expiry time to temporary passwords
261263 * (bug 16720) Transcluded Special:NewPages processes "/username="
262264 * Added "Advanced search" link to the search form
263265 * Special:Upload can now have a custom upload message instead of uploadtext by

Follow-up revisions

RevisionCommit summaryAuthorDate
r45551* Update languages/messages/* to r45543 with the exception of English (alread...siebrand07:21, 8 January 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r45450(bug 2242) Introduce expiry time for temporary passwords.demon16:21, 6 January 2009
r45485Revert r45450, r45451 "(bug 2242) Introduce expiry time for temporary passwor...brion03:54, 7 January 2009

Comments

#Comment by Brion VIBBER (talk | contribs)   18:17, 13 January 2009

w00t!

Status & tagging log