mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/OATHAuth
synced 2024-11-24 00:05:24 +00:00
Add link from Special:Preferences to manage OATH
Change-Id: I281f08a363bbfb7eab6003513b8326d468a8c85a
This commit is contained in:
parent
f5498babf5
commit
967a12654b
|
@ -44,6 +44,8 @@ $messages['en'] = array(
|
|||
'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 @@ Extension name, found on Special:Version',
|
|||
'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)
|
||||
|
|
|
@ -54,6 +54,7 @@ $wgHooks['ChangePasswordForm'][] = 'OATHUser::ChangePasswordForm';
|
|||
$wgHooks['TwoFactorIsEnabled'][] = 'OATHUser::TwoFactorIsEnabled';
|
||||
# Schema updates
|
||||
$wgHooks['LoadExtensionSchemaUpdates'][] = 'efOATHAuthSchemaUpdates';
|
||||
$wgHooks['GetPreferences'][] = 'OATHUser::manageOATH';
|
||||
|
||||
/**
|
||||
* @param $updater DatabaseUpdater
|
||||
|
|
16
OATHUser.php
16
OATHUser.php
|
@ -346,4 +346,20 @@ class OATHUser {
|
|||
}
|
||||
}
|
||||
|
||||
public static function manageOATH( User $user, array &$preferences ) {
|
||||
$link = Linker::link( SpecialPage::getTitleFor( 'OATH' ),
|
||||
wfMessage( 'oathauth-prefs-manage' )->escaped(),
|
||||
array(),
|
||||
array( 'returnto' => SpecialPage::getTitleFor( 'Preferences' )->getPrefixedText() )
|
||||
);
|
||||
|
||||
$preferences['oath'] = array(
|
||||
'type' => 'info',
|
||||
'raw' => 'true',
|
||||
'default' => $link,
|
||||
'label-message' => 'oathauth-prefs-label',
|
||||
'section' => 'personal/info',
|
||||
);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue