mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/OATHAuth
synced 2024-11-24 00:05:24 +00:00
Upgrade Extension:OATHAuth to the registration system
Bug: T87949 Change-Id: Id6217249c11922ab7d25b31375789c40d737600c
This commit is contained in:
parent
923d19797c
commit
961dd687b9
|
@ -1,36 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This is a backwards-compatibility shim, generated by:
|
||||
* https://git.wikimedia.org/blob/mediawiki%2Fcore.git/HEAD/maintenance%2FgenerateJsonI18n.php
|
||||
*
|
||||
* Beginning with MediaWiki 1.23, translation strings are stored in json files,
|
||||
* and the EXTENSION.i18n.php file only exists to provide compatibility with
|
||||
* older releases of MediaWiki. For more information about this migration, see:
|
||||
* https://www.mediawiki.org/wiki/Requests_for_comment/Localisation_format
|
||||
*
|
||||
* This shim maintains compatibility back to MediaWiki 1.17.
|
||||
*/
|
||||
$messages = array();
|
||||
if ( !function_exists( 'wfJsonI18nShim886e5f0000466d60' ) ) {
|
||||
/** @noinspection PhpMissingDocCommentInspection */
|
||||
function wfJsonI18nShim886e5f0000466d60( $cache, $code, &$cachedData ) {
|
||||
$codeSequence = array_merge( array( $code ), $cachedData['fallbackSequence'] );
|
||||
foreach ( $codeSequence as $csCode ) {
|
||||
$fileName = dirname( __FILE__ ) . "/i18n/$csCode.json";
|
||||
if ( is_readable( $fileName ) ) {
|
||||
$data = FormatJson::decode( file_get_contents( $fileName ), true );
|
||||
foreach ( array_keys( $data ) as $key ) {
|
||||
if ( $key === '' || $key[0] === '@' ) {
|
||||
unset( $data[$key] );
|
||||
}
|
||||
}
|
||||
$cachedData['messages'] = array_merge( $data, $cachedData['messages'] );
|
||||
}
|
||||
|
||||
$cachedData['deps'][] = new FileDependency( $fileName );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
$GLOBALS['wgHooks']['LocalisationCacheRecache'][] = 'wfJsonI18nShim886e5f0000466d60';
|
||||
}
|
70
OATHAuth.php
70
OATHAuth.php
|
@ -12,64 +12,18 @@
|
|||
* @license GNU General Public Licence 2.0 or later
|
||||
*/
|
||||
|
||||
if ( !defined( 'MEDIAWIKI' ) ) {
|
||||
echo "This file is an extension to the MediaWiki software and cannot be used standalone.\n";
|
||||
die( 1 );
|
||||
}
|
||||
if ( function_exists( 'wfLoadExtension' ) ) {
|
||||
wfLoadExtension( 'OATHAuth' );
|
||||
|
||||
$wgExtensionCredits['other'][] = array(
|
||||
'path' => __FILE__,
|
||||
'name' => 'OATHAuth',
|
||||
'author' => 'Ryan Lane',
|
||||
'version' => '0.2.1',
|
||||
'url' => 'http://mediawiki.org/wiki/Extension:OATHAuth',
|
||||
'descriptionmsg' => 'oathauth-desc',
|
||||
);
|
||||
|
||||
/**
|
||||
* The number of token windows in each direction that should be valid
|
||||
*
|
||||
* This tells OATH to accept tokens for a range of $wgOATHAuthWindowRadius * 2 windows
|
||||
* (which is effectively ((1 + 2 * $wgOATHAuthWindowRadius) * 30) seconds).
|
||||
* This range of valid windows is centered around the current time.
|
||||
*
|
||||
* The purpose of this configuration variable is to account for differences between
|
||||
* the user's clock and the server's clock. However, it is recommended to keep it as
|
||||
* low as possible.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$wgOATHAuthWindowRadius = 4;
|
||||
|
||||
$dir = __DIR__ . '/';
|
||||
|
||||
$wgMessagesDirs['OATHAuth'] = __DIR__ . '/i18n';
|
||||
$wgExtensionMessagesFiles['OATHAuth'] = $dir . 'OATHAuth.i18n.php';
|
||||
$wgExtensionMessagesFiles['OATHAuthAlias'] = $dir . 'OATHAuth.alias.php';
|
||||
$wgAutoloadClasses['OATHAuthHooks'] = $dir . 'OATHAuth.hooks.php';
|
||||
$wgAutoloadClasses['HOTP'] = $dir . 'lib/hotp.php';
|
||||
$wgAutoloadClasses['HOTPResult'] = $dir . 'lib/hotp.php';
|
||||
$wgAutoloadClasses['Base32'] = $dir . 'lib/base32.php';
|
||||
$wgAutoloadClasses['OATHUser'] = $dir . 'OATHUser.php';
|
||||
$wgAutoloadClasses['SpecialOATH'] = $dir . 'special/SpecialOATH.php';
|
||||
$wgSpecialPages['OATH'] = 'SpecialOATH';
|
||||
|
||||
$wgResourceModules['ext.oathauth'] = array(
|
||||
'scripts' => array(
|
||||
'modules/jquery.qrcode.js',
|
||||
'modules/qrcode.js',
|
||||
),
|
||||
'position' => 'top',
|
||||
'localBasePath' => dirname( __FILE__ ),
|
||||
'remoteExtPath' => 'OATHAuth',
|
||||
);
|
||||
|
||||
$wgHooks['AbortChangePassword'][] = 'OATHAuthHooks::AbortChangePassword';
|
||||
$wgHooks['AbortLogin'][] = 'OATHAuthHooks::AbortLogin';
|
||||
$wgHooks['UserLoginForm'][] = 'OATHAuthHooks::ModifyUITemplate';
|
||||
$wgHooks['ChangePasswordForm'][] = 'OATHAuthHooks::ChangePasswordForm';
|
||||
$wgHooks['TwoFactorIsEnabled'][] = 'OATHAuthHooks::TwoFactorIsEnabled';
|
||||
$wgHooks['LoadExtensionSchemaUpdates'][] = 'OATHAuthHooks::OATHAuthSchemaUpdates';
|
||||
$wgHooks['GetPreferences'][] = 'OATHAuthHooks::manageOATH';
|
||||
$wgMessagesDirs['OATHAuth'] = __DIR__ . '/i18n';
|
||||
$wgExtensionMessagesFiles['OATHAuthAlias'] = __DIR__ . 'OATHAuth.alias.php';
|
||||
|
||||
/* wfWarn(
|
||||
'Deprecated PHP entry point used for OATHAuth extension. Please use wfLoadExtension instead, ' .
|
||||
'see https://www.mediawiki.org/wiki/Extension_registration for more details.'
|
||||
); */
|
||||
|
||||
return true;
|
||||
} else {
|
||||
die( 'This version of the OATHAuth extension requires MediaWiki 1.25+' );
|
||||
}
|
67
extension.json
Normal file
67
extension.json
Normal file
|
@ -0,0 +1,67 @@
|
|||
{
|
||||
"name": "OATHAuth",
|
||||
"version": "0.2.1",
|
||||
"author": "Ryan Lane",
|
||||
"url": "http://mediawiki.org/wiki/Extension:OATHAuth",
|
||||
"descriptionmsg": "oathauth-desc",
|
||||
"type": "other",
|
||||
"AutoloadClasses": {
|
||||
"OATHAuthHooks": "OATHAuth.hooks.php",
|
||||
"HOTP": "lib/hotp.php",
|
||||
"HOTPResult": "lib/hotp.php",
|
||||
"Base32": "lib/base32.php",
|
||||
"OATHUser": "OATHUser.php",
|
||||
"SpecialOATH": "special/SpecialOATH.php"
|
||||
},
|
||||
"ExtensionMessagesFiles": {
|
||||
"OATHAuthAlias": "OATHAuth.alias.php"
|
||||
},
|
||||
"Hooks": {
|
||||
"AbortChangePassword": [
|
||||
"OATHAuthHooks::AbortChangePassword"
|
||||
],
|
||||
"AbortLogin": [
|
||||
"OATHAuthHooks::AbortLogin"
|
||||
],
|
||||
"UserLoginForm": [
|
||||
"OATHAuthHooks::ModifyUITemplate"
|
||||
],
|
||||
"ChangePasswordForm": [
|
||||
"OATHAuthHooks::ChangePasswordForm"
|
||||
],
|
||||
"TwoFactorIsEnabled": [
|
||||
"OATHAuthHooks::TwoFactorIsEnabled"
|
||||
],
|
||||
"LoadExtensionSchemaUpdates": [
|
||||
"OATHAuthHooks::OATHAuthSchemaUpdates"
|
||||
],
|
||||
"GetPreferences": [
|
||||
"OATHAuthHooks::manageOATH"
|
||||
]
|
||||
},
|
||||
"MessagesDirs": {
|
||||
"OATHAuth": [
|
||||
"i18n"
|
||||
]
|
||||
},
|
||||
"config": {
|
||||
"OATHAuthWindowRadius": 4
|
||||
},
|
||||
"ResourceModules": {
|
||||
"ext.oathauth": {
|
||||
"scripts": [
|
||||
"modules/jquery.qrcode.js",
|
||||
"modules/qrcode.js"
|
||||
],
|
||||
"position": "top"
|
||||
}
|
||||
},
|
||||
"ResourceFileModulePaths": {
|
||||
"localBasePath": "",
|
||||
"remoteExtPath": "OATHAuth"
|
||||
},
|
||||
"SpecialPages": {
|
||||
"OATH": "SpecialOATH"
|
||||
},
|
||||
"manifest_version": 1
|
||||
}
|
Loading…
Reference in a new issue