Glaisher has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/233106

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, 9 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/06/233106/1

diff --git a/includes/specials/SpecialChangeEmail.php 
b/includes/specials/SpecialChangeEmail.php
index c2aa704..dd27b0f 100644
--- a/includes/specials/SpecialChangeEmail.php
+++ b/includes/specials/SpecialChangeEmail.php
@@ -92,7 +92,13 @@
                        'NewEmail' => array(
                                'type' => 'email',
                                'label-message' => 'changeemail-newemail',
-                               'autofocus' => true
+                               'autofocus' => true,
+                               'validation-callback' => function ( $val ) use 
( $user ) {
+                                               if ( $val === $user->getEmail() 
) {
+                                                       return  $this->msg( 
'changeemail-nochange' )->parse();
+                                               }
+                                               return true;
+                                       },
                        ),
                );
 
diff --git a/languages/i18n/en.json b/languages/i18n/en.json
index 51cc927..21bd21e 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 0cf37cd..af9f3c0 100644
--- a/languages/i18n/qqq.json
+++ b/languages/i18n/qqq.json
@@ -734,6 +734,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: newchange
Gerrit-Change-Id: I6173cd653f682d5a1be61104db213b577c4adfcf
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Glaisher <[email protected]>

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

Reply via email to