Passed
Pull Request — master (#245)
by
unknown
03:21
created

EmailProvider   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 11
dl 0
loc 36
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 1
A getId() 0 2 1
A getDescription() 0 2 1
A getDisplayName() 0 2 1
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * @author Christoph Wurst <[email protected]>
7
 *
8
 * Nextcloud - Two-factor Gateway
9
 *
10
 * This code is free software: you can redistribute it and/or modify
11
 * it under the terms of the GNU Affero General Public License, version 3,
12
 * as published by the Free Software Foundation.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
 * GNU Affero General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU Affero General Public License, version 3,
20
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
21
 *
22
 */
23
24
namespace OCA\TwoFactorGateway\Provider;
25
26
use OCA\TwoFactorGateway\Service\Gateway\Email\Gateway;
27
use OCA\TwoFactorGateway\Service\StateStorage;
28
use OCP\IL10N;
29
use OCP\ISession;
30
use OCP\Security\ISecureRandom;
31
32
class EmailProvider extends AProvider {
33
34
	public function __construct(Gateway $smsGateway,
35
								StateStorage $stateStorage,
36
								ISession $session,
37
								ISecureRandom $secureRandom,
38
								IL10N $l10n) {
39
		parent::__construct(
40
			'email',
41
			$smsGateway,
42
			$stateStorage,
43
			$session,
44
			$secureRandom,
45
			$l10n
46
		);
47
	}
48
49
	/**
50
	 * Get unique identifier of this 2FA provider
51
	 */
52
	public function getId(): string {
53
		return 'gateway_email';
54
	}
55
56
	/**
57
	 * Get the display name for selecting the 2FA provider
58
	 */
59
	public function getDisplayName(): string {
60
		return $this->l10n->t('Email verification');
61
	}
62
63
	/**
64
	 * Get the description for selecting the 2FA provider
65
	 */
66
	public function getDescription(): string {
67
		return $this->l10n->t('Authenticate via Email');
68
	}
69
70
}
71