jenkins-bot has submitted this change and it was merged.

Change subject: Use login-throttled properly everywhere
......................................................................


Use login-throttled properly everywhere

Actually proper usage would probably be to split the messages.
Followup to Id385be840f340476fbe7a818ff1d05154fe86d68;
spotted by Shirayuki.
https://translatewiki.net/wiki/Thread:Support/About_MediaWiki:Login-throttled/en

Change-Id: I565971a90fc383327a51d717a80013cb7a3e9c9b
---
M includes/specials/SpecialChangeEmail.php
M includes/specials/SpecialChangePassword.php
M languages/messages/MessagesQqq.php
3 files changed, 11 insertions(+), 6 deletions(-)

Approvals:
  Nikerabbit: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/specials/SpecialChangeEmail.php 
b/includes/specials/SpecialChangeEmail.php
index 816938d..aab839f 100644
--- a/includes/specials/SpecialChangeEmail.php
+++ b/includes/specials/SpecialChangeEmail.php
@@ -225,7 +225,7 @@
         * @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 @@
 
                $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;
                }
diff --git a/includes/specials/SpecialChangePassword.php 
b/includes/specials/SpecialChangePassword.php
index 139bb6d..129e919 100644
--- a/includes/specials/SpecialChangePassword.php
+++ b/includes/specials/SpecialChangePassword.php
@@ -230,6 +230,8 @@
         * @throws PasswordError when cannot set the new password because 
requirements not met.
         */
        protected function attemptReset( $newpass, $retype ) {
+               global $wgPasswordAttemptThrottle;
+
                $isSelf = ( $this->mUserName === $this->getUser()->getName() );
                if ( $isSelf ) {
                        $user = $this->getUser();
@@ -248,7 +250,11 @@
 
                $throttleCount = LoginForm::incLoginThrottle( $this->mUserName 
);
                if ( $throttleCount === true ) {
-                       throw new PasswordError( $this->msg( 'login-throttled' 
)->text() );
+                       $lang = $this->getLanguage();
+                       throw new PasswordError( $this->msg( 'login-throttled' )
+                               ->params( $lang->formatDuration( 
$wgPasswordAttemptThrottle['seconds'] ) )
+                               ->text()
+                       );
                }
 
                $abortMsg = 'resetpass-abort-generic';
diff --git a/languages/messages/MessagesQqq.php 
b/languages/messages/MessagesQqq.php
index be58cbc..73c1ddf 100644
--- a/languages/messages/MessagesQqq.php
+++ b/languages/messages/MessagesQqq.php
@@ -1490,10 +1490,8 @@
 * $3 - a password (randomly generated)
 * $4 - a URL to the wiki ('<' + server name + script name + '>')
 * $5 - (Unused) number of days to password expiry date",
-'login-throttled' => '{{doc-important|<code>$1</code> is empty, which is used 
in [[Special:ChangeEmail]] and [[Special:ChangePassword]].}}
-Used as error message in [[Special:ChangeEmail]], [[Special:ChangePassword]], 
and [[Special:UserLogin]].
+'login-throttled' => 'Error message shown at [[Special:UserLogin]] after the 
user has tried to login with incorrect password too many times; also used by 
[[Special:ChangeEmail]] and [[Special:ChangePassword]].
 
-Error message shown at [[Special:UserLogin]] after the user has tried to login 
with incorrect password too many times.
 The user has to wait a certain time before trying to log in again.
 
 Parameters:

-- 
To view, visit https://gerrit.wikimedia.org/r/79784
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I565971a90fc383327a51d717a80013cb7a3e9c9b
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Nemo bis <[email protected]>
Gerrit-Reviewer: Grunny <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: Shirayuki <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to