SpecialChangeEmail: error if old email was entered in new email field
authorGlaisher <glaisher.wiki@gmail.com>
Sat, 22 Aug 2015 12:27:56 +0000 (17:27 +0500)
committerUmherirrender <umherirrender_de.wp@web.de>
Fri, 18 Sep 2015 15:39:43 +0000 (15:39 +0000)
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

includes/specials/SpecialChangeEmail.php
languages/i18n/en.json
languages/i18n/qqq.json

index c2aa704..22df04e 100644 (file)
@@ -160,6 +160,10 @@ class SpecialChangeEmail extends FormSpecialPage {
                        return Status::newFatal( 'invalidemailaddress' );
                }
 
                        return Status::newFatal( 'invalidemailaddress' );
                }
 
+               if ( $newaddr === $user->getEmail() ) {
+                       return Status::newFatal( 'changeemail-nochange' );
+               }
+
                $throttleCount = LoginForm::incLoginThrottle( $user->getName() );
                if ( $throttleCount === true ) {
                        $lang = $this->getLanguage();
                $throttleCount = LoginForm::incLoginThrottle( $user->getName() );
                if ( $throttleCount === true ) {
                        $lang = $this->getLanguage();
index 3bf72d5..12bd910 100644 (file)
        "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-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.",
        "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.",
index d3b5a99..8109698 100644 (file)
        "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-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]].",
        "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]].",