Ryan Lane has uploaded a new change for review.

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


Change subject: Add link from Special:Preferences to manage OATH
......................................................................

Add link from Special:Preferences to manage OATH

Change-Id: I281f08a363bbfb7eab6003513b8326d468a8c85a
---
M OATHAuth.i18n.php
M OATHAuth.php
M OATHUser.php
3 files changed, 21 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OATHAuth 
refs/changes/50/52950/1

diff --git a/OATHAuth.i18n.php b/OATHAuth.i18n.php
index 03f789a..b8a08da 100644
--- a/OATHAuth.i18n.php
+++ b/OATHAuth.i18n.php
@@ -44,6 +44,8 @@
        'oathauth-failedtoresetoath' => 'Failed to reset two factor 
credentials.',
        'oathauth-notloggedin' => 'Login required',
        'oathauth-mustbeloggedin' => 'You must be logged in to perform this 
action.',
+       'oathauth-prefs-label' => 'Two-factor authentication:',
+       'oathauth-prefs-manage' => 'Manage two-factor authentication',
 );
 
 /** Message documentation (Message documentation)
@@ -82,6 +84,8 @@
        'oathauth-notloggedin' => 'Page title seen on Special:OATH when a user 
is not logged in.
 {{Identical|Login required}}',
        'oathauth-mustbeloggedin' => 'Plain text seen on Special:OATH when a 
user is not logged in.',
+       'oathauth-prefs-label' => 'Plain text label seen on 
Special:Preferences',
+       'oathauth-prefs-manage' => 'Link to Special:OATH from 
Special:Preferences',
 );
 
 /** Breton (brezhoneg)
diff --git a/OATHAuth.php b/OATHAuth.php
index a660949..a8aceeb 100644
--- a/OATHAuth.php
+++ b/OATHAuth.php
@@ -54,6 +54,7 @@
 $wgHooks['TwoFactorIsEnabled'][] = 'OATHUser::TwoFactorIsEnabled';
 # Schema updates
 $wgHooks['LoadExtensionSchemaUpdates'][] = 'efOATHAuthSchemaUpdates';
+$wgHooks['GetPreferences'][] = 'OATHUser::manageOATH';
 
 /**
  * @param $updater DatabaseUpdater
diff --git a/OATHUser.php b/OATHUser.php
index a51e915..dbe87ec 100644
--- a/OATHUser.php
+++ b/OATHUser.php
@@ -346,4 +346,20 @@
                }
        }
 
+       public static function manageOATH( User $user, array &$preferences ) {
+               $link = Linker::link( SpecialPage::getTitleFor( 'OATH' ),
+                       wfMessage( 'oathauth-prefs-label' )->escaped(),
+                       array(),
+                       array( 'returnto' => SpecialPage::getTitleFor( 
'Preferences' )->getPrefixedText() )
+               );
+
+               $preferences['oath'] = array(
+                       'type' => 'info',
+                       'raw' => 'true',
+                       'default' => $link,
+                       'label-message' => 'oathauth-prefs-manage',
+                       'section' => 'personal/info',
+               );
+               return true;
+       }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/52950
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I281f08a363bbfb7eab6003513b8326d468a8c85a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/OATHAuth
Gerrit-Branch: master
Gerrit-Owner: Ryan Lane <[email protected]>

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

Reply via email to