1
1
<?php
2
2
/**
3
- * Copyright © Magento, Inc. All rights reserved.
4
- * See COPYING.txt for license details .
3
+ * Copyright 2016 Adobe
4
+ * All Rights Reserved .
5
5
*/
6
6
namespace Magento \Customer \Model ;
7
7
8
8
use Magento \Customer \Api \CustomerRepositoryInterface ;
9
9
use Magento \Customer \Model \ResourceModel \CustomerRepository ;
10
- use Magento \Customer \Model \CustomerAuthUpdate ;
11
10
use Magento \Backend \App \ConfigInterface ;
11
+ use Magento \Framework \App \ObjectManager ;
12
12
use Magento \Framework \Encryption \EncryptorInterface as Encryptor ;
13
13
use Magento \Framework \Exception \InvalidEmailOrPasswordException ;
14
14
use Magento \Framework \Exception \State \UserLockedException ;
15
15
16
16
/**
17
- * Class Authentication
17
+ * Class Authentication model
18
18
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
19
19
*/
20
20
class Authentication implements AuthenticationInterface
21
21
{
22
22
/**
23
23
* Configuration path to customer lockout threshold
24
24
*/
25
- const LOCKOUT_THRESHOLD_PATH = 'customer/password/lockout_threshold ' ;
25
+ public const LOCKOUT_THRESHOLD_PATH = 'customer/password/lockout_threshold ' ;
26
26
27
27
/**
28
28
* Configuration path to customer max login failures number
29
29
*/
30
- const MAX_FAILURES_PATH = 'customer/password/lockout_failures ' ;
30
+ public const MAX_FAILURES_PATH = 'customer/password/lockout_failures ' ;
31
31
32
32
/**
33
33
* @var CustomerRegistry
@@ -67,19 +67,22 @@ class Authentication implements AuthenticationInterface
67
67
* @param ConfigInterface $backendConfig
68
68
* @param \Magento\Framework\Stdlib\DateTime $dateTime
69
69
* @param Encryptor $encryptor
70
+ * @param CustomerAuthUpdate|null $customerAuthUpdate
70
71
*/
71
72
public function __construct (
72
73
CustomerRepositoryInterface $ customerRepository ,
73
74
CustomerRegistry $ customerRegistry ,
74
75
ConfigInterface $ backendConfig ,
75
76
\Magento \Framework \Stdlib \DateTime $ dateTime ,
76
- Encryptor $ encryptor
77
+ Encryptor $ encryptor ,
78
+ CustomerAuthUpdate $ customerAuthUpdate = null
77
79
) {
78
80
$ this ->customerRepository = $ customerRepository ;
79
81
$ this ->customerRegistry = $ customerRegistry ;
80
82
$ this ->backendConfig = $ backendConfig ;
81
83
$ this ->dateTime = $ dateTime ;
82
84
$ this ->encryptor = $ encryptor ;
85
+ $ this ->customerAuthUpdate = $ customerAuthUpdate ?: ObjectManager::getInstance ()->get (CustomerAuthUpdate::class);
83
86
}
84
87
85
88
/**
@@ -116,7 +119,7 @@ public function processAuthenticationFailure($customerId)
116
119
}
117
120
118
121
$ customerSecure ->setFailuresNum ($ failuresNum );
119
- $ this ->getCustomerAuthUpdate () ->saveAuth ($ customerId );
122
+ $ this ->customerAuthUpdate ->saveAuth ($ customerId );
120
123
}
121
124
122
125
/**
@@ -128,7 +131,7 @@ public function unlock($customerId)
128
131
$ customerSecure ->setFailuresNum (0 );
129
132
$ customerSecure ->setFirstFailure (null );
130
133
$ customerSecure ->setLockExpires (null );
131
- $ this ->getCustomerAuthUpdate () ->saveAuth ($ customerId );
134
+ $ this ->customerAuthUpdate ->saveAuth ($ customerId );
132
135
}
133
136
134
137
/**
@@ -176,19 +179,4 @@ public function authenticate($customerId, $password)
176
179
}
177
180
return true ;
178
181
}
179
-
180
- /**
181
- * Get customer authentication update model
182
- *
183
- * @return \Magento\Customer\Model\CustomerAuthUpdate
184
- * @deprecated 100.1.1
185
- */
186
- private function getCustomerAuthUpdate ()
187
- {
188
- if ($ this ->customerAuthUpdate === null ) {
189
- $ this ->customerAuthUpdate =
190
- \Magento \Framework \App \ObjectManager::getInstance ()->get (CustomerAuthUpdate::class);
191
- }
192
- return $ this ->customerAuthUpdate ;
193
- }
194
182
}
0 commit comments