forked from osTicket/osTicket-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
auth2fa.php
48 lines (36 loc) · 1.29 KB
/
auth2fa.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
<?php
require_once(INCLUDE_DIR.'class.plugin.php');
require_once('config.php');
require_once('class.auth2fa.php');
class Auth2FAPlugin extends Plugin {
var $config_class = "Auth2FAConfig";
function bootstrap() {
$config = $this->getConfig();
if ($config->get('custom_issuer'))
Auth2FABackend::$custom_issuer = $config->get('custom_issuer');
TwoFactorAuthenticationBackend::register('Auth2FABackend');
}
function enable() {
return parent::enable();
}
function uninstall(&$errors) {
$errors = array();
self::disable();
return parent::uninstall($errors);
}
function disable() {
$default2fas = ConfigItem::getConfigsByNamespace(false, 'default_2fa', Auth2FABackend::$id);
foreach($default2fas as $default2fa)
$default2fa->delete();
$tokens = ConfigItem::getConfigsByNamespace(false, Auth2FABackend::$id);
foreach($tokens as $token)
$token->delete();
return parent::disable();
}
}
require_once(INCLUDE_DIR.'UniversalClassLoader.php');
use Symfony\Component\ClassLoader\UniversalClassLoader_osTicket;
$loader = new UniversalClassLoader_osTicket();
$loader->registerNamespaceFallbacks(array(
dirname(__file__).'/lib'));
$loader->register();