Merge "Allow extensions to indicate a username doesn't exist"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 4 Sep 2014 22:41:27 +0000 (22:41 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 4 Sep 2014 22:41:27 +0000 (22:41 +0000)
1  2 
docs/hooks.txt
includes/specials/SpecialUserlogin.php
languages/i18n/en.json
languages/i18n/qqq.json

diff --combined docs/hooks.txt
@@@ -863,6 -863,14 +863,14 @@@ $name: name of the special page, e.g. '
  &$join_conds: join conditions for the tables
  $opts: FormOptions for this request
  
+ 'LoginUserMigrated': Called during login to allow extensions the opportunity to
+ inform a user that their username doesn't exist for a specific reason, instead
+ of letting the login form give the generic error message that the account does
+ not exist. For example, when the account has been renamed or deleted.
+ $user: the User object being authenticated against.
+ &$msg: the message identifier for abort reason, or an array to pass a message
+   key and parameters.
  'Collation::factory': Called if $wgCategoryCollation is an unknown collation.
  $collationName: Name of the collation in question
  &$collationObject: Null. Replace with a subclass of the Collation class that
@@@ -1635,13 -1643,6 +1643,13 @@@ $code: language cod
  &$alldata: The localisation data from core and extensions
  &purgeBlobs: whether to purge/update the message blobs via MessageBlobStore::clear()
  
 +'LocalisationCacheRecacheFallback': Called for each language when merging
 +fallback data into the cache.
 +$cache: The LocalisationCache object
 +$code: language code
 +&$alldata: The localisation data from core and extensions. Note some keys may
 +  be omitted if they won't be merged into the final result.
 +
  'LocalisationChecksBlacklist': When fetching the blacklist of
  localisation checks.
  &$blacklist: array of checks to blacklist. See the bottom of
@@@ -2299,11 -2300,6 +2307,11 @@@ $type: 'normal' or 'history' for old/di
  the MediaWiki icon but plain text instead.
  $skin: Skin object
  
 +'SkinPreloadExistence': Supply titles that should be added to link existence
 +cache before the page is rendered.
 +&$titles: Array of Title objects
 +$skin: Skin object
 +
  'SkinSubPageSubtitle': At the beginning of Skin::subPageSubtitle().
  &$subpages: Subpage links HTML
  $skin: Skin object
@@@ -2954,18 -2950,12 +2962,18 @@@ $page: WikiPage object to be watche
  $user: user that watched
  $page: WikiPage object watched
  
 +'WatchlistEditorBeforeFormRender': Before building the Special:EditWatchlist
 +form, used to manipulate the list of pages or preload data based on that list.
 +&$watchlistInfo: array of watchlisted pages in
 +  [namespaceId => ['title1' => 1, 'title2' => 1]] format
 +
  'WatchlistEditorBuildRemoveLine': when building remove lines in
  Special:Watchlist/edit.
  &$tools: array of extra links
  $title: Title object
  $redirect: whether the page is a redirect
  $skin: Skin object
 +&$link: HTML link to title
  
  'WebRequestPathInfoRouter': While building the PathRouter to parse the
  REQUEST_URI.
@@@ -41,6 -41,7 +41,7 @@@ class LoginForm extends SpecialPage 
        const USER_BLOCKED = 11;
        const NEED_TOKEN = 12;
        const WRONG_TOKEN = 13;
+       const USER_MIGRATED = 14;
  
        /**
         * Valid error and warning messages
                }
  
                $u = User::newFromName( $this->mUsername );
+               // Give extensions a way to indicate the username has been updated,
+               // rather than telling the user the account doesn't exist.
+               if ( !wfRunHooks( 'LoginUserMigrated', array( $u, &$msg ) ) ) {
+                       $this->mAbortLoginErrorMsg = $msg;
+                       return self::USER_MIGRATED;
+               }
                if ( !( $u instanceof User ) || !User::isUsableName( $u->getName() ) ) {
                        return self::ILLEGAL;
                }
                                $this->mainLoginForm( $this->msg( $error,
                                                wfEscapeWikiText( $this->mUsername ) )->text() );
                                break;
+                       case self::USER_MIGRATED:
+                               $error = $this->mAbortLoginErrorMsg ?: 'login-migrated-generic';
+                               $params = array();
+                               if ( is_array( $error ) ) {
+                                       $error = array_shift( $this->mAbortLoginErrorMsg );
+                                       $params = $this->mAbortLoginErrorMsg;
+                               }
+                               $this->mainLoginForm( $this->msg( $error, $params )->text() );
+                               break;
                        default:
                                throw new MWException( 'Unhandled case value' );
                }
                $template->set( 'cansecurelogin', ( $wgSecureLogin === true ) );
                $template->set( 'stickhttps', (int)$this->mStickHTTPS );
                $template->set( 'loggedin', $user->isLoggedIn() );
 -              $template->set( 'loggedinuser', $user->getName() );
  
                if ( $this->mType == 'signup' ) {
                        if ( !self::getCreateaccountToken() ) {
diff --combined languages/i18n/en.json
        "userlogin-resetpassword-link": "Forgot your password?",
        "helplogin-url": "https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Logging_in",
        "userlogin-helplink2": "Help with logging in",
 -      "userlogin-loggedin": "You are already logged in as {{GENDER:$1|$1}}.\nUse the form below to log in as another user.",
 -      "userlogin-createanother": "Create another account",
        "createacct-emailrequired": "Email address",
        "createacct-emailoptional": "Email address (optional)",
        "createacct-email-ph": "Enter your email address",
        "createaccount-text": "Someone created an account for your email address on {{SITENAME}} ($4) named \"$2\", with password \"$3\".\nYou should log in and change your password now.\n\nYou may ignore this message, if this account was created in error.",
        "login-throttled": "You have made too many recent login attempts.\nPlease wait $1 before trying again.",
        "login-abort-generic": "Your login was unsuccessful - Aborted",
+       "login-migrated-generic": "Your account has been migrated, and your username no longer exist on this wiki.",
        "loginlanguagelabel": "Language: $1",
        "loginlanguagelinks": "* {{#language:de}}|de\n* {{#language:en}}|en\n* {{#language:eo}}|eo\n* {{#language:fr}}|fr\n* {{#language:es}}|es\n* {{#language:it}}|it\n* {{#language:nl}}|nl",
        "suspicious-userlogout": "Your request to log out was denied because it looks like it was sent by a broken browser or caching proxy.",
        "showpreview": "Show preview",
        "showdiff": "Show changes",
        "blankarticle": "<strong>Warning:</strong> The page you are creating is blank.\nIf you click \"{{int:savearticle}}\" again, the page will be created without any content.",
 -      "anoneditwarning": "<strong>Warning:</strong> You are not logged in.\nYour IP address will be recorded in this page's edit history.",
 +      "anoneditwarning": "<strong>Warning:</strong> You are not logged in. Your IP address will be publicly visible if you make any edits. If you <strong>[$1 log in]</strong> or <strong>[$2 create an account]</strong>, your edits will be attributed to your username, along with other benefits.",
        "anonpreviewwarning": "<em>You are not logged in. Saving will record your IP address in this page's edit history.</em>",
        "missingsummary": "<strong>Reminder:</strong> You have not provided an edit summary.\nIf you click \"{{int:savearticle}}\" again, your edit will be saved without one.",
        "missingcommenttext": "Please enter a comment below.",
diff --combined languages/i18n/qqq.json
        "userlogin-resetpassword-link": "Used as link text in the login form.\n\nThe link points to the local page [[Special:PasswordReset]].\n\nSee example: [[Special:UserLogin]]\n\nuserlogin-resetpassword-link may have to be shorter than the old {{msg-mw|userlogin-resetlink}}.\n{{Identical|Forgot your password}}",
        "helplogin-url": "{{doc-important|Do not translate the namespace name <code>Help</code>.}}\nUsed as name of the page that provides information about logging into the wiki.\n\nUsed as a link target in the message {{msg-mw|Userlogin-helplink}}.",
        "userlogin-helplink2": "Label for a link to login help.\n\nSee example: [[Special:UserLogin]]\n\nSee also:\n* {{msg-mw|Helplogin-url}}",
 -      "userlogin-loggedin": "Used as warning on [[Special:UserLogin]] when the current user is already logged in.\n\nFollowed by the Login form.\n\nSee example: [[Special:UserLogin]].\n\nParameters:\n* $1 - user name (used for display and for gender support)",
 -      "userlogin-createanother": "Used as label for the button on [[Special:UserLogin]] shown when the current user is already logged in.\n{{Identical|Create another account}}",
        "createacct-emailrequired": "Label in create account form for email field when it is required.\n\nSee also:\n* {{msg-mw|Createacct-emailoptional}}\n{{Identical|E-mail address}}",
        "createacct-emailoptional": "Label in vertical-layout create account form for email field when it is optional.\n\nSee example: [{{canonicalurl:Special:UserLogin|type=signup}} Special:UserLogin?type=signup]\n\nSee also:\n* {{msg-mw|Createacct-emailrequired}}",
        "createacct-email-ph": "Placeholder in vertical-layout create account form for email field.\n\nSee example: [{{canonicalurl:Special:UserLogin|type=signup}} Special:UserLogin?type=signup]",
        "createaccount-text": "Body of the email sent to the email address entered at [[Special:CreateAccount]] when one user creates an account for another and clicks the checkbox labelled:\n* {{msg-mw|Createaccountmail}}\n\nParameters:\n* $1 - (Unused) IP address\n* $2 - the name entered as username\n* $3 - a password (randomly generated)\n* $4 - a URL to the wiki ('<' + server name + script name + '>')\n* $5 - (Unused) number of days to password expiry date",
        "login-throttled": "Error message shown at [[Special:UserLogin]] 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{{identical|Login throttled}}",
        "login-abort-generic": "The generic unsuccessful login message is used unless otherwise specified by hook writers",
+       "login-migrated-generic": "The generic unsuccessful login message when the user's account has been updated, and their username no longer exist",
        "loginlanguagelabel": "Used on [[Special:UserLogin]] if $wgLoginLanguageSelector is true. Parameters:\n* $1 - a pipe-separated list built from the names that appear in the message {{msg-mw|Loginlanguagelinks}}.\n{{Identical|Language}}",
        "loginlanguagelinks": "{{notranslate}}",
        "suspicious-userlogout": "Used when the logout request looks suspicious, in Special:UserLogout.",
        "showpreview": "The text of the button to preview the page you are editing. See also {{msg-mw|showdiff}} and {{msg-mw|savearticle}} for the other buttons.\n\nSee also:\n* {{msg-mw|Showpreview}}\n* {{msg-mw|Accesskey-preview}}\n* {{msg-mw|Tooltip-preview}}\n{{Identical|Show preview}}",
        "showdiff": "Button below the edit page. See also {{msg-mw|Showpreview}} and {{msg-mw|Savearticle}} for the other buttons.\n\nSee also:\n* {{msg-mw|Showdiff}}\n* {{msg-mw|Accesskey-diff}}\n* {{msg-mw|Tooltip-diff}}\n{{Identical|Show change}}",
        "blankarticle": "Notice displayed once after the user tries to save an empty page.",
 -      "anoneditwarning": "Shown when editing a page anonymously.\nSee also:\n* {{msg-mw|Sf autoedit anoneditwarning}}\n* {{msg-mw|Wikibase-anonymouseditwarning-property}}\n* {{msg-mw|Wikibase-anonymouseditwarning-item}}\n* {{msg-mw|Anonpreviewwarning}}",
 +      "anoneditwarning": "Shown when editing a page anonymously.\n\nParameters:\n* $1 – A link to log in, <nowiki>{{fullurl:Special:UserLogin|returnto={{FULLPAGENAMEE}}}}</nowiki>\n* $2 – A link to sign up, <nowiki>{{fullurl:Special:UserLogin/signup|returnto={{FULLPAGENAMEE}}}}</nowiki>\n\nSee also:\n* {{msg-mw|Sf autoedit anoneditwarning}}\n* {{msg-mw|Wikibase-anonymouseditwarning-property}}\n* {{msg-mw|Wikibase-anonymouseditwarning-item}}\n* {{msg-mw|Anonpreviewwarning}}",
        "anonpreviewwarning": "See also:\n* {{msg-mw|Anoneditwarning}}",
        "missingsummary": "The text \"edit summary\" is in {{msg-mw|Summary}}.\n\nSee also:\n* {{msg-mw|Missingcommentheader}}\n* {{msg-mw|Savearticle}}",
        "missingcommenttext": "This message is shown, when the textbox by a new-section is empty.",
        "session_fail_preview_html": "Used as error message in Preview page.",
        "token_suffix_mismatch": "Error message in Preview page.\n\nSee also:\n* {{msg-mw|Token suffix mismatch}}\n* {{msg-mw|Session fail preview}}\n* {{msg-mw|Edit form incomplete}}",
        "edit_form_incomplete": "Error message in Preview page.\n\nSee also:\n* {{msg-mw|Token suffix mismatch}}\n* {{msg-mw|Session fail preview}}\n* {{msg-mw|Edit form incomplete}}",
 -      "editing": "Shown as page title when editing a page. Parameters:\n* $1 - the name of the page that is being edited. e.g. \"Editing Main Page\"\n{{Related|Editing}}",
 -      "creating": "Shown as page title when creating a page. Parameters:\n* $1 - the name of the page that is being created. Example: \"Creating Main Page\".\n{{Related|Editing}}",
 +      "editing": "Shown as page title when editing a page. Parameters:\n* $1 - the name of the page that is being edited. e.g. \"Editing Main Page\"\n{{Related|Editing}}\n{{Identical|Editing}}",
 +      "creating": "Shown as page title when creating a page. Parameters:\n* $1 - the name of the page that is being created. Example: \"Creating Main Page\".\n{{Related|Editing}}\n{{Identical|Creating}}",
        "editingsection": "This message displays at the top of the page when a user is editing a page section. Parameters:\n* $1 - page name\n{{Related|Editing}}",
        "editingcomment": "This message displays at the top of the page when a user is creating a new section. Parameters:\n* $1 - page name\n{{Related|Editing}}",
        "editconflict": "Used as title of error message. Parameters:\n* $1 - page title",
        "group-bureaucrat": "{{doc-group|bureaucrat}}",
        "group-suppress": "{{doc-group|suppress}}\nThis is an optional (disabled by default) user group, meant for the [[mw:RevisionDelete|RevisionDelete]] feature, to change the visibility of revisions through [[Special:RevisionDelete]].\n\n{{Identical|Oversight}}",
        "group-all": "The name of the user group that contains all users, including anonymous users\n\n{{Identical|All}}",
 -      "group-user-member": "{{doc-group|user|member}}",
 +      "group-user-member": "{{doc-group|user|member}}\n{{Identical|User}}",
        "group-autoconfirmed-member": "{{doc-group|autoconfirmed|member}}",
        "group-bot-member": "{{doc-group|bot|member}}",
        "group-sysop-member": "{{doc-group|sysop|member}}",
        "group-bureaucrat-member": "{{doc-group|bureaucrat|member}}",
        "group-suppress-member": "{{doc-group|suppress|member}}\nThis is a member of the optional (disabled by default) user group, meant for the [[mw:RevisionDelete|RevisionDelete]] feature, to change the visibility of revisions through [[Special:RevisionDelete]].\n\n{{Identical|Oversight}}",
 -      "grouppage-user": "{{doc-group|user|page}}",
 +      "grouppage-user": "{{doc-group|user|page}}\n{{Identical|User}}",
        "grouppage-autoconfirmed": "{{doc-group|autoconfirmed|page}}",
        "grouppage-bot": "{{doc-group|bot|page}}\n{{Identical|Bot}}",
        "grouppage-sysop": "{{doc-group|sysop|page}}",
        "blocklist-addressblocks": "Used as the label for the multi-select checkbox in the form on [[Special:BlockList]].\n{{Related|Blocklist-blocks}}",
        "blocklist-rangeblocks": "Used as the label for the multi-select checkbox in the form on [[Special:BlockList]].\n\nFor an explanation of \"range blocks\", see [[mw:Help:Range_blocks]]\n{{Related|Blocklist-blocks}}",
        "blocklist-timestamp": "This is a column header for dates and times in the table on the page [[Special:BlockList]].\n{{Identical|Timestamp}}",
 -      "blocklist-target": "The table header for the column containing the block targets, that is user names or IP-addresses linked to their respective user pages, in the table on the page [[Special:BlockList]].",
 +      "blocklist-target": "The table header for the column containing the block targets, that is user names or IP-addresses linked to their respective user pages, in the table on the page [[Special:BlockList]].\n{{Identical|Target}}",
        "blocklist-expiry": "This is a column header in the table on the page [[Special:BlockList]].\n{{Identical|Expire}}",
        "blocklist-by": "This is a column header in the table on the page [[Special:BlockList]].",
        "blocklist-params": "This is a column header in the table on the page [[Special:BlockList]].",
        "lockfilenotwritable": "'No longer needed' on wikipedia.",
        "databasenotlocked": "Used as error message in [[Special:UnlockDB]].\nThe title of this error message is {{msg-mw|Lockdb}}.\n\nSee also:\n* {{msg-mw|Lockdb|title}}\n* {{msg-mw|Databasenotlocked|message}}",
        "lockedbyandtime": "Used as part of the message when a database is locked through [[Special:LockDB]]. Parameters:\n* $1 is the user that locked the database.\n* $2 is the date on which the lock was made\n* $3 is the time at which the lock was made",
 -      "move-page": "Used as page title of [[Special:MovePage]] to move pages.\n\nSee example: [[Special:MovePage/Portal:En]].\n\nParameters:\n* $1 - the name of the page to be moved (without link)",
 +      "move-page": "Used as page title of [[Special:MovePage]] to move pages.\n\nSee example: [[Special:MovePage/Portal:En]].\n\nParameters:\n* $1 - the name of the page to be moved (without link)\n{{Identical|Move}}",
        "movepage-summary": "{{doc-specialpagesummary|movepage}}",
        "move-page-legend": "Legend of the fieldset around the input form of [[Special:MovePage/testpage]].\n\nSee also:\n* {{msg-mw|movearticle|label for old title}}\n* {{msg-mw|newtitle|label for new title}}\n* {{msg-mw|movereason|label for textarea}}\n* {{msg-mw|movetalk|label for checkbox}}\n* {{msg-mw|move-leave-redirect|label for checkbox}}\n* {{msg-mw|fix-double-redirects|label for checkbox}}\n* {{msg-mw|move-subpages|label for checkbox}}\n* {{msg-mw|move-talk-subpages|label for checkbox}}\n* {{msg-mw|move-watch|label for checkbox}}\n{{Identical|Move page}}",
        "movepagetext": "Introduction shown when moving a page ([[Special:MovePage]]).\n\nSpecial pages mentioned: {{msg-mw|Doubleredirects}}, {{msg-mw|Brokenredirects}}\n\nSee also:\n* {{msg-mw|Movepagetext-noredirectfixer}}",