Merge "Exclude override to make method public from checks"
[lhc/web/wiklou.git] / includes / specials / SpecialChangeEmail.php
index 816938d..d02886f 100644 (file)
@@ -75,7 +75,7 @@ class SpecialChangeEmail extends UnlistedSpecialPage {
                $user = $this->getUser();
                $request = $this->getRequest();
 
-               if ( !$request->wasPosted() && !$user->isLoggedIn() ) {
+               if ( !$user->isLoggedIn() ) {
                        $this->error( 'changeemail-no-info' );
 
                        return;
@@ -225,7 +225,7 @@ class SpecialChangeEmail extends UnlistedSpecialPage {
         * @return bool|string true or string on success, false on failure
         */
        protected function attemptChange( User $user, $pass, $newaddr ) {
-               global $wgAuth;
+               global $wgAuth, $wgPasswordAttemptThrottle;
 
                if ( $newaddr != '' && !Sanitizer::validateEmail( $newaddr ) ) {
                        $this->error( 'invalidemailaddress' );
@@ -235,7 +235,8 @@ class SpecialChangeEmail extends UnlistedSpecialPage {
 
                $throttleCount = LoginForm::incLoginThrottle( $user->getName() );
                if ( $throttleCount === true ) {
-                       $this->error( 'login-throttled' );
+                       $lang = $this->getLanguage();
+                       $this->error( array( 'login-throttled', $lang->formatDuration( $wgPasswordAttemptThrottle['seconds'] ) ) );
 
                        return false;
                }