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

Change subject: SpecialChangeEmail: error if old email was entered in new email 
field
......................................................................


SpecialChangeEmail: error if old email was entered in new email field

Current behavior is to redirect to Special:Preferences without showing
any message.  Instead of that, showing an error message is user-friendlier.

Bug: T38561
Change-Id: I6173cd653f682d5a1be61104db213b577c4adfcf
---
M includes/specials/SpecialChangeEmail.php
M languages/i18n/en.json
M languages/i18n/qqq.json
3 files changed, 6 insertions(+), 0 deletions(-)

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



diff --git a/includes/specials/SpecialChangeEmail.php 
b/includes/specials/SpecialChangeEmail.php
index c2aa704..22df04e 100644
--- a/includes/specials/SpecialChangeEmail.php
+++ b/includes/specials/SpecialChangeEmail.php
@@ -160,6 +160,10 @@
                        return Status::newFatal( 'invalidemailaddress' );
                }
 
+               if ( $newaddr === $user->getEmail() ) {
+                       return Status::newFatal( 'changeemail-nochange' );
+               }
+
                $throttleCount = LoginForm::incLoginThrottle( $user->getName() 
);
                if ( $throttleCount === true ) {
                        $lang = $this->getLanguage();
diff --git a/languages/i18n/en.json b/languages/i18n/en.json
index 3bf72d5..12bd910 100644
--- a/languages/i18n/en.json
+++ b/languages/i18n/en.json
@@ -563,6 +563,7 @@
        "changeemail-password": "Your {{SITENAME}} password:",
        "changeemail-submit": "Change email",
        "changeemail-throttled": "You have made too many login 
attempts.\nPlease wait $1 before trying again.",
+       "changeemail-nochange": "Please enter a different new email address.",
        "resettokens": "Reset tokens",
        "resettokens-summary": "",
        "resettokens-text": "You can reset tokens which allow access to certain 
private data associated with your account here.\n\nYou should do it if you 
accidentally shared them with someone or if your account has been compromised.",
diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json
index d3b5a99..8109698 100644
--- a/languages/i18n/qqq.json
+++ b/languages/i18n/qqq.json
@@ -736,6 +736,7 @@
        "changeemail-password": "Label for password field in 
[[Special:ChangeEmail]].",
        "changeemail-submit": "Submit button on [[Special:ChangeEmail]]",
        "changeemail-throttled": "Error message shown at 
[[Special:ChangeEmail]] after the user has tried to login with incorrect 
password too many times.\n\nThe user has to wait a certain time before trying 
to log in again.\n\nParameters:\n* $1 - the time to wait before the next login 
attempt. Automatically formatted using the following duration messages:\n** 
{{msg-mw|Duration-millennia}}\n** {{msg-mw|Duration-centuries}}\n** 
{{msg-mw|Duration-decades}}\n** {{msg-mw|Duration-years}}\n** 
{{msg-mw|Duration-weeks}}\n** {{msg-mw|Duration-days}}\n** 
{{msg-mw|Duration-hours}}\n** {{msg-mw|Duration-minutes}}\n** 
{{msg-mw|Duration-seconds}}\n\nThis is a protection against robots trying to 
find the password by trying lots of them.\nThe number of attempts and waiting 
time are configured via 
[[mw:Manual:$wgPasswordAttemptThrottle|$wgPasswordAttemptThrottle]].\nThis 
message is used in html.\n\nSee also:\n* {{msg-mw|Changepassword-throttled}}",
+       "changeemail-nochange": "Error message shown on [[Special:ChangeEmail]] 
if the old email address was entered in the new email address field.",
        "resettokens": "{{doc-special|ResetTokens}}\nIn this case \"token\" may 
be translated as \"key\", or similar.\n{{Identical|Reset token}}",
        "resettokens-summary": "{{ignored}}",
        "resettokens-text": "Text on [[Special:ResetTokens]].",

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I6173cd653f682d5a1be61104db213b577c4adfcf
Gerrit-PatchSet: 8
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Glaisher <glaisher.w...@gmail.com>
Gerrit-Reviewer: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com>
Gerrit-Reviewer: Glaisher <glaisher.w...@gmail.com>
Gerrit-Reviewer: Siebrand <siebr...@kitano.nl>
Gerrit-Reviewer: Umherirrender <umherirrender_de...@web.de>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to