forked from MohsinQK/cf_google_authenticator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ext_tables.php
70 lines (65 loc) · 2.87 KB
/
ext_tables.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
/**
* Configuration file for TYPO3 CMS Extension 'cf_google_authenticator'
*
* This script is only included when a TYPO3 Backend or CLI request is
* happening or the TYPO3 Frontend is called and a valid Backend User is
* authenticated.
* It is used for registering backend modules, adding context-sensitive-help
* docs, adding table-options, making assignments to the global configuration
* arrays $TBE_STYLES and $PAGES_TYPES, etc.
*
* @author Robin 'codeFareith' von den Bergen <[email protected]>
* @copyright (c) 2018 by Robin von den Bergen
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version 1.0.0
*
* @link https://github.com/codeFareith/cf_google_authenticator
* @see https://www.fareith.de
* @see https://typo3.org
*/
/** @noinspection PhpFullyQualifiedNameUsageInspection */
defined('TYPO3_MODE')
or die('Access denied.');
call_user_func(
static function (/*$_EXTKEY*/) {
$globalsReference = &$GLOBALS;
$globalsReference['TBE_STYLES']
['stylesheet2'] = \CodeFareith\CfGoogleAuthenticator\Utility\PathUtility::makeExtensionPath('Resources/Public/Css/cf_google_authenticator.css');
if (TYPO3_version >= '9.0.0') {
$globalsReference['TYPO3_USER_SETTINGS']['columns'] = array_merge(
$globalsReference['TYPO3_USER_SETTINGS']['columns'],
[
'tx_cfgoogleauthenticator_enabled' => [
'label' => \CodeFareith\CfGoogleAuthenticator\Utility\PathUtility::makeLocalLangLinkPath(
'be_users.tx_cfgoogleauthenticator_enabled',
'locallang_db.xlf'
),
'type' => 'check',
'table' => 'be_users',
],
'tx_cfgoogleauthenticator_secret' => [
'label' => \CodeFareith\CfGoogleAuthenticator\Utility\PathUtility::makeLocalLangLinkPath(
'be_users.tx_cfgoogleauthenticator_secret',
'locallang_db.xlf'
),
'type' => 'user',
'userFunc' => \CodeFareith\CfGoogleAuthenticator\Hook\UserSettings::class . '->createSecretField',
'table' => 'be_users',
],
]
);
}
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addFieldsToUserSettings(
'--div--;'
. \CodeFareith\CfGoogleAuthenticator\Utility\PathUtility::makeLocalLangLinkPath(
'tx_cfgoogleauthenticator',
'locallang_db.xlf'
) . ',
tx_cfgoogleauthenticator_enabled,
tx_cfgoogleauthenticator_secret'
);
},
/** @var string $_EXTKEY */
$_EXTKEY
);