Index: trunk/phase3/includes/specials/SpecialPasswordReset.php |
— | — | @@ -36,9 +36,8 @@ |
37 | 37 | global $wgPasswordResetRoutes, $wgAuth; |
38 | 38 | |
39 | 39 | // Maybe password resets are disabled, or there are no allowable routes |
40 | | - if ( !is_array( $wgPasswordResetRoutes ) |
41 | | - || !in_array( true, array_values( $wgPasswordResetRoutes ) ) ) |
42 | | - { |
| 40 | + if ( !is_array( $wgPasswordResetRoutes ) || |
| 41 | + !in_array( true, array_values( $wgPasswordResetRoutes ) ) ) { |
43 | 42 | throw new ErrorPageError( 'internalerror', 'passwordreset-disabled' ); |
44 | 43 | } |
45 | 44 | |
— | — | @@ -224,4 +223,31 @@ |
225 | 224 | $this->getOutput()->addWikiMsg( 'passwordreset-emailsent' ); |
226 | 225 | $this->getOutput()->returnToMain(); |
227 | 226 | } |
228 | | -} |
| 227 | + |
| 228 | + /** |
| 229 | + * Hide the password reset page if resets are disabled. |
| 230 | + * @return Bool |
| 231 | + */ |
| 232 | + function isListed() { |
| 233 | + global $wgPasswordResetRoutes, $wgAuth; |
| 234 | + |
| 235 | + // Maybe password resets are disabled, or there are no allowable routes |
| 236 | + if ( !is_array( $wgPasswordResetRoutes ) || |
| 237 | + !in_array( true, array_values( $wgPasswordResetRoutes ) ) ) { |
| 238 | + return false; |
| 239 | + } |
| 240 | + |
| 241 | + // Maybe the external auth plugin won't allow local password changes |
| 242 | + if ( !$wgAuth->allowPasswordChange() ) { |
| 243 | + return false; |
| 244 | + } |
| 245 | + |
| 246 | + // Maybe the user is blocked (check this here rather than relying on the parent |
| 247 | + // method as we have a more specific error message to use here |
| 248 | + if ( $user->isBlocked() ) { |
| 249 | + return false; |
| 250 | + } |
| 251 | + |
| 252 | + return parent::isListed(); |
| 253 | + } |
| 254 | +} |
\ No newline at end of file |