|
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\Block\Customer\Account\Create; |
|
23
|
|
|
|
|
24
|
|
|
use Rossmitchell\Twofactor\Model\Config\Customer; |
|
25
|
|
|
use Magento\Framework\View\Element\Template; |
|
26
|
|
|
|
|
27
|
|
|
class UseTwoFactor extends Template |
|
28
|
|
|
{ |
|
29
|
|
|
/** |
|
30
|
|
|
* @var Customer |
|
31
|
|
|
*/ |
|
32
|
|
|
private $customerConfig; |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* UseTwoFactor constructor. |
|
36
|
|
|
* |
|
37
|
|
|
* @param Template\Context $context |
|
38
|
|
|
* @param Customer $customerConfig |
|
39
|
|
|
* @param array $data |
|
40
|
|
|
*/ |
|
41
|
4 |
|
public function __construct(Template\Context $context, Customer $customerConfig, array $data = []) |
|
42
|
|
|
{ |
|
43
|
4 |
|
parent::__construct($context, $data); |
|
44
|
4 |
|
$this->customerConfig = $customerConfig; |
|
45
|
4 |
|
} |
|
46
|
|
|
|
|
47
|
4 |
|
public function shouldFieldBeDisplayed() |
|
48
|
|
|
{ |
|
49
|
4 |
|
return ($this->customerConfig->isTwoFactorEnabled() == true); |
|
50
|
|
|
} |
|
51
|
|
|
} |
|
52
|
|
|
|