From: Glaisher Date: Sat, 22 Aug 2015 12:27:56 +0000 (+0500) Subject: SpecialChangeEmail: error if old email was entered in new email field X-Git-Tag: 1.31.0-rc.0~9972 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=5970f6c1d9f1cbbe65eb13dcca0ce7088476e6e3;hp=59ebff658ce912c1b0e7ef8d8f9bfec5a4e17b39 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 --- diff --git a/includes/specials/SpecialChangeEmail.php b/includes/specials/SpecialChangeEmail.php index c2aa704ab1..22df04e828 100644 --- a/includes/specials/SpecialChangeEmail.php +++ b/includes/specials/SpecialChangeEmail.php @@ -160,6 +160,10 @@ class SpecialChangeEmail extends FormSpecialPage { 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 3bf72d5c0b..12bd910a2d 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 d3b5a99ddb..8109698e31 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]].",