|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* A two factor authentication module that protects both the admin and customer logins |
|
4
|
|
|
* Copyright (C) 2017 Ross Mitchell |
|
5
|
|
|
* |
|
6
|
|
|
* This file is part of Rossmitchell/Twofactor. |
|
7
|
|
|
* |
|
8
|
|
|
* Rossmitchell/Twofactor is free software: you can redistribute it and/or modify |
|
9
|
|
|
* it under the terms of the GNU General Public License as published by |
|
10
|
|
|
* the Free Software Foundation, either version 3 of the License, or |
|
11
|
|
|
* (at your option) any later version. |
|
12
|
|
|
* |
|
13
|
|
|
* This program is distributed in the hope that it will be useful, |
|
14
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16
|
|
|
* GNU General Public License for more details. |
|
17
|
|
|
* |
|
18
|
|
|
* You should have received a copy of the GNU General Public License |
|
19
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
20
|
|
|
*/ |
|
21
|
|
|
|
|
22
|
|
|
namespace Rossmitchell\Twofactor\Model\Config; |
|
23
|
|
|
|
|
24
|
|
|
use Magento\Framework\App\Config\ScopeConfigInterface; |
|
25
|
|
|
|
|
26
|
|
|
class Admin |
|
27
|
|
|
{ |
|
28
|
|
|
const IS_ENABLED_PATH = 'two_factor_admin_users/details/enable'; |
|
29
|
|
|
const COMPANY_NAME_PATH = 'two_factor_admin_users/details/company_name'; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* @var ScopeConfigInterface |
|
33
|
|
|
*/ |
|
34
|
|
|
private $scopeConfig; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* Admin constructor. |
|
38
|
|
|
* |
|
39
|
|
|
* @param ScopeConfigInterface $scopeConfig |
|
40
|
|
|
*/ |
|
41
|
18 |
|
public function __construct(ScopeConfigInterface $scopeConfig) |
|
42
|
|
|
{ |
|
43
|
18 |
|
$this->scopeConfig = $scopeConfig; |
|
44
|
18 |
|
} |
|
45
|
|
|
|
|
46
|
18 |
|
public function isTwoFactorEnabled() |
|
47
|
|
|
{ |
|
48
|
18 |
|
return $this->scopeConfig->getValue(self::IS_ENABLED_PATH); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
1 |
|
public function getCompanyName() |
|
52
|
|
|
{ |
|
53
|
1 |
|
return $this->scopeConfig->getValue(self::COMPANY_NAME_PATH); |
|
54
|
|
|
} |
|
55
|
|
|
} |
|
56
|
|
|
|