Index: trunk/phase3/maintenance/tables.sql |
— | — | @@ -76,7 +76,10 @@ |
77 | 77 | user_newpassword tinyblob NOT NULL, |
78 | 78 | |
79 | 79 | -- Timestamp of the last time when a new password was |
80 | | - -- sent, for throttling purposes |
| 80 | + -- sent, for throttling and expiring purposes |
| 81 | + -- Emailed passwords will expire $wgNewPasswordExpiry |
| 82 | + -- (a week) after being set. If user_newpass_time is NULL |
| 83 | + -- (eg. created by mail) it doesn't expire. |
81 | 84 | user_newpass_time binary(14), |
82 | 85 | |
83 | 86 | -- Note: email should be restricted, not public info. |
Index: trunk/phase3/includes/User.php |
— | — | @@ -2820,7 +2820,9 @@ |
2821 | 2821 | function checkTemporaryPassword( $plaintext ) { |
2822 | 2822 | global $wgNewPasswordExpiry; |
2823 | 2823 | if( self::comparePasswords( $this->mNewpassword, $plaintext, $this->getId() ) ) { |
2824 | | - $this->load(); |
| 2824 | + if ( is_null( $this->mNewpassTime ) ) { |
| 2825 | + return true; |
| 2826 | + } |
2825 | 2827 | $expiry = wfTimestamp( TS_UNIX, $this->mNewpassTime ) + $wgNewPasswordExpiry; |
2826 | 2828 | return ( time() < $expiry ); |
2827 | 2829 | } else { |