5
5
*/
6
6
namespace Magento \Customer \Model ;
7
7
8
- use Magento \Customer \Model \ResourceModel \CustomerAuthenticationRepository ;
8
+ use Magento \Customer \Model \ResourceModel \CustomerRepository ;
9
+ use Magento \Customer \Model \CustomerAuthUpdate ;
9
10
use Magento \Backend \App \ConfigInterface ;
10
11
use Magento \Framework \Encryption \EncryptorInterface as Encryptor ;
11
12
use Magento \Framework \Exception \InvalidEmailOrPasswordException ;
@@ -46,19 +47,24 @@ class Authentication implements AuthenticationInterface
46
47
protected $ encryptor ;
47
48
48
49
/**
49
- * @var CustomerAuthenticationRepository
50
+ * @var CustomerRepository
50
51
*/
51
52
protected $ customerRepository ;
52
53
53
54
/**
54
- * @param CustomerAuthenticationRepository $customerRepository
55
+ * @var CustomerAuthUpdate
56
+ */
57
+ private $ customerAuthUpdate ;
58
+
59
+ /**
60
+ * @param CustomerRepository $customerRepository
55
61
* @param CustomerRegistry $customerRegistry
56
62
* @param ConfigInterface $backendConfig
57
63
* @param \Magento\Framework\Stdlib\DateTime $dateTime
58
64
* @param Encryptor $encryptor
59
65
*/
60
66
public function __construct (
61
- CustomerAuthenticationRepository $ customerRepository ,
67
+ CustomerRepository $ customerRepository ,
62
68
CustomerRegistry $ customerRegistry ,
63
69
ConfigInterface $ backendConfig ,
64
70
\Magento \Framework \Stdlib \DateTime $ dateTime ,
@@ -105,7 +111,7 @@ public function processAuthenticationFailure($customerId)
105
111
}
106
112
107
113
$ customerSecure ->setFailuresNum ($ failuresNum );
108
- $ this ->customerRepository -> save ( $ this -> customerRepository -> getById ($ customerId) );
114
+ $ this ->getCustomerAuthUpdate ()-> saveAuth ($ customerId );
109
115
}
110
116
111
117
/**
@@ -117,7 +123,7 @@ public function unlock($customerId)
117
123
$ customerSecure ->setFailuresNum (0 );
118
124
$ customerSecure ->setFirstFailure (null );
119
125
$ customerSecure ->setLockExpires (null );
120
- $ this ->customerRepository -> save ( $ this -> customerRepository -> getById ($ customerId) );
126
+ $ this ->getCustomerAuthUpdate ()-> saveAuth ($ customerId );
121
127
}
122
128
123
129
/**
@@ -165,4 +171,19 @@ public function authenticate($customerId, $password)
165
171
}
166
172
return true ;
167
173
}
174
+
175
+ /**
176
+ * Get customer authentication update model
177
+ *
178
+ * @return \Magento\Customer\Model\CustomerAuthUpdate
179
+ * @deprecated
180
+ */
181
+ private function getCustomerAuthUpdate ()
182
+ {
183
+ if ($ this ->customerAuthUpdate === null ) {
184
+ $ this ->customerAuthUpdate =
185
+ \Magento \Framework \App \ObjectManager::getInstance ()->get (CustomerAuthUpdate::class);
186
+ }
187
+ return $ this ->customerAuthUpdate ;
188
+ }
168
189
}
0 commit comments