Index: trunk/extensions/PasswordReset/PasswordReset_body.php |
— | — | @@ -167,4 +167,41 @@ |
168 | 168 | |
169 | 169 | return true; |
170 | 170 | } |
| 171 | + |
| 172 | + function GetBlockedStatus(&$user) { |
| 173 | + global $wgTitle; |
| 174 | + |
| 175 | + if ($wgTitle->isSpecial('Userlogin')) { |
| 176 | + global $wgRequest; |
| 177 | + if ($wgRequest->wasPosted()) { |
| 178 | + $name = $wgRequest->getText('wpName'); |
| 179 | + if ($name <> '') { |
| 180 | + |
| 181 | + $dbr = wfGetDB( DB_SLAVE ); |
| 182 | + $res = $dbr->select( 'user', |
| 183 | + array( 'user_password' ), |
| 184 | + array( 'user_name' => $name ), |
| 185 | + __METHOD__ ); |
| 186 | + |
| 187 | + while ( $row = $dbr->fetchObject( $res ) ) { |
| 188 | + if ($row->user_password == 'DISABLED') { |
| 189 | + $user->mBlockedby = 1; |
| 190 | + $user->mBlockreason = wfMsg( 'passwordreset-accountdisabled' ); |
| 191 | + } |
| 192 | + } |
| 193 | + } |
| 194 | + } |
| 195 | + } elseif ( $user->isLoggedIn() ) { |
| 196 | + if ($user->mPassword == 'DISABLED') { |
| 197 | + global $wgOut; |
| 198 | + //mean, I know. |
| 199 | + $user->logout(); |
| 200 | + $wgOut->redirect( Title::newMainPage()->escapeFullURL()); |
| 201 | + } |
| 202 | + } else { |
| 203 | + echo "not logged in (" . $user->getID() . ")"; |
| 204 | + } |
| 205 | + |
| 206 | + return true; |
| 207 | + } |
171 | 208 | } |
Index: trunk/extensions/PasswordReset/PasswordReset.i18n.php |
— | — | @@ -18,7 +18,8 @@ |
19 | 19 | 'passwordreset-success' => 'Password has been reset for user_id: $1', |
20 | 20 | 'passwordreset-disableuser' => 'Disable User Account?', |
21 | 21 | 'passwordreset-disableuserexplain' => '(sets an invalid password hash - user can\'t login)', |
22 | | - 'passwordreset-disablesuccess' => 'User account has been disabled (user_id: $1)' |
| 22 | + 'passwordreset-disablesuccess' => 'User account has been disabled (user_id: $1)', |
| 23 | + 'passwordreset-accountdisabled' => 'Account has been disabled' |
23 | 24 | ), |
24 | 25 | |
25 | 26 | 'af' => array( |
Index: trunk/extensions/PasswordReset/PasswordReset.php |
— | — | @@ -10,11 +10,11 @@ |
11 | 11 | } |
12 | 12 | |
13 | 13 | $wgExtensionCredits['specialpage'][] = array( |
14 | | - 'name'=>'Password Reset', |
15 | | - 'url'=>'http://www.mediawiki.org/wiki/Extension:Password_Reset', |
16 | | - 'author'=>'Tim Laqua', |
17 | | - 'description'=>"Resets Wiki user's passwords - requires 'passwordreset' privileges", |
18 | | - 'version'=>'1.3', |
| 14 | + 'name'=>'Password Reset', |
| 15 | + 'url'=>'http://www.mediawiki.org/wiki/Extension:Password_Reset', |
| 16 | + 'author'=>'Tim Laqua', |
| 17 | + 'description'=>"Resets Wiki user's passwords - requires 'passwordreset' privileges", |
| 18 | + 'version'=>'1.4' |
19 | 19 | ); |
20 | 20 | |
21 | 21 | $wgAutoloadClasses['PasswordReset'] = dirname(__FILE__) . '/PasswordReset_body.php'; |
— | — | @@ -26,3 +26,5 @@ |
27 | 27 | } else { |
28 | 28 | $wgHooks['LoadAllMessages'][] = 'PasswordReset::loadMessages'; |
29 | 29 | } |
| 30 | + |
| 31 | +$wgHooks['GetBlockedStatus'][] = 'PasswordReset::GetBlockedStatus'; |