Preferences: Don't show the watchlist token; just link to ResetTokens
authorJames D. Forrester <jforrester@wikimedia.org>
Mon, 20 Nov 2017 23:34:06 +0000 (15:34 -0800)
committerBartosz Dziewoński <matma.rex@gmail.com>
Mon, 20 Nov 2017 23:53:16 +0000 (23:53 +0000)
Also make both the PasswordReset and ResetTokens forms appropriately
flag their action buttons as destructive.

Bug: T180710
Change-Id: I26649900f9360e5175fa93b87dc7840a7c1d4f93

includes/Preferences.php
includes/specials/SpecialPasswordReset.php
includes/specials/SpecialResetTokens.php
languages/i18n/en.json
languages/i18n/qqq.json

index e383f03..924e3ad 100644 (file)
@@ -1134,18 +1134,20 @@ class Preferences {
                        $defaultPreferences['watchlisttoken'] = [
                                'type' => 'api',
                        ];
+
+                       $tokenButton = new OOUI\ButtonWidget( [
+                               'href' => SpecialPage::getTitleFor( 'ResetTokens' )->getLinkURL( [
+                                       'returnto' => SpecialPage::getTitleFor( 'Preferences' )->getPrefixedText()
+                               ] ),
+                               'label' => $context->msg( 'prefs-watchlist-managetokens' )->text(),
+                       ] );
                        $defaultPreferences['watchlisttoken-info'] = [
                                'type' => 'info',
                                'section' => 'watchlist/tokenwatchlist',
                                'label-message' => 'prefs-watchlist-token',
-                               'default' => $user->getTokenFromOption( 'watchlisttoken' ),
-                               'help-message' => 'prefs-help-watchlist-token2',
-                       ];
-                       $defaultPreferences['watchlisttoken-info2'] = [
-                               'type' => 'info',
-                               'section' => 'watchlist/tokenwatchlist',
+                               'help-message' => 'prefs-help-tokenmanagement',
                                'raw' => true,
-                               'default' => $context->msg( 'prefs-help-watchlist-token2' )->parse(),
+                               'default' => (string)$tokenButton,
                        ];
                }
        }
index a4f16bd..bf8dea6 100644 (file)
@@ -110,6 +110,8 @@ class SpecialPasswordReset extends FormSpecialPage {
        public function alterForm( HTMLForm $form ) {
                $resetRoutes = $this->getConfig()->get( 'PasswordResetRoutes' );
 
+               $form->setSubmitDestructive();
+
                $form->addHiddenFields( $this->getRequest()->getValues( 'returnto', 'returntoquery' ) );
 
                $i = 0;
index 964a261..d5b0903 100644 (file)
@@ -121,6 +121,7 @@ class SpecialResetTokens extends FormSpecialPage {
         * @param HTMLForm $form
         */
        protected function alterForm( HTMLForm $form ) {
+               $form->setSubmitDestructive();
                if ( $this->getTokensList() ) {
                        $form->setSubmitTextMsg( 'resettokens-resetbutton' );
                } else {
index 021a115..261f74b 100644 (file)
        "prefs-watchlist-edits": "Maximum number of changes to show in watchlist:",
        "prefs-watchlist-edits-max": "Maximum number: 1000",
        "prefs-watchlist-token": "Watchlist token:",
+       "prefs-watchlist-managetokens": "Manage tokens",
        "prefs-misc": "Misc",
        "prefs-resetpass": "Change password",
        "prefs-changeemail": "Change or remove email address",
        "recentchangesdays-max": "Maximum $1 {{PLURAL:$1|day|days}}",
        "recentchangescount": "Number of edits to show by default:",
        "prefs-help-recentchangescount": "This includes recent changes, page histories, and logs.",
-       "prefs-help-watchlist-token2": "This is the secret key to the web feed of your watchlist.\nAnyone who knows it will be able to read your watchlist, so do not share it.\nIf you need to, [[Special:ResetTokens|you can reset it]].",
+       "prefs-help-tokenmanagement": "You can see and reset the secret key for your account that can access the Web feed of your watchlist. Anyone who knows the key will be able to read your watchlist, so do not share it.",
        "savedprefs": "Your preferences have been saved.",
        "savedrights": "The user groups of {{GENDER:$1|$1}} have been saved.",
        "timezonelegend": "Time zone:",
index a1e65c0..b2fce4a 100644 (file)
        "prefs-watchlist-edits": "Used in [[Special:Preferences]], tab \"Watchlist\".",
        "prefs-watchlist-edits-max": "Shown as hint in [[Special:Preferences]], tab \"Watchlist\"",
        "prefs-watchlist-token": "Used in [[Special:Preferences]], tab Watchlist.",
+       "prefs-watchlist-managetokens": "Label for the button to see and reset the user's private tokens",
        "prefs-misc": "Tab used on the [[Special:Preferences|user preferences]] special page.",
        "prefs-resetpass": "Button on user data tab in user preferences. When you click the button you go to the special page [[Special:ResetPass]].\n\n{{Identical|Change password}}",
        "prefs-changeemail": "Link on [[Special:Preferences]] to [[Special:ChangeEmail]]. [[Special:ChangeEmail]] also allows removing email address. \n\nSee also:\n* {{msg-mw|prefs-help-email-required|help}}\n* {{msg-mw|prefs-help-email|help}}\n* {{msg-mw|prefs-help-email-others|help}}\n* {{msg-mw|prefs-setemail|link title}}",
        "recentchangesdays-max": "Shown as hint in [[Special:Preferences]], tab \"Recent changes\". Parameters:\n* $1 - number of days\nSee also:\n* {{msg-mw|Prefs-watchlist-days-max}}",
        "recentchangescount": "Used in [[Special:Preferences]], tab \"Recent changes\".",
        "prefs-help-recentchangescount": "Used in [[Special:Preferences]], tab \"Recent changes\".",
-       "prefs-help-watchlist-token2": "Used in [[Special:Preferences]], tab Watchlist. (Formerly in {{msg-mw|prefs-help-watchlist-token}}.)",
+       "prefs-help-tokenmanagement": "Used in [[Special:Preferences]], Watchlist tab.",
        "savedprefs": "This message appears after saving changes to your user preferences.",
        "savedrights": "This message appears after saving the user groups on [[Special:UserRights]].\n* $1 - The user name of the user which groups was saved.",
        "timezonelegend": "{{Identical|Time zone}}",