14
14
use Magento \Customer \Api \CustomerRepositoryInterface ;
15
15
use Magento \Customer \Api \Data \AddressInterface ;
16
16
use Magento \Customer \Api \Data \CustomerInterface ;
17
+ use Magento \Customer \Api \Data \ValidationResultsInterfaceFactory ;
17
18
use Magento \Customer \Helper \View as CustomerViewHelper ;
18
19
use Magento \Customer \Model \Config \Share as ConfigShare ;
19
20
use Magento \Customer \Model \Customer as CustomerModel ;
20
21
use Magento \Customer \Model \Metadata \Validator ;
22
+ use Magento \Framework \Api \ExtensibleDataObjectConverter ;
21
23
use Magento \Framework \App \Config \ScopeConfigInterface ;
22
24
use Magento \Framework \Encryption \EncryptorInterface as Encryptor ;
23
25
use Magento \Framework \Event \ManagerInterface ;
30
32
use Magento \Framework \Exception \State \ExpiredException ;
31
33
use Magento \Framework \Exception \State \InputMismatchException ;
32
34
use Magento \Framework \Exception \State \InvalidTransitionException ;
35
+ use Magento \Framework \ObjectFactory ;
36
+ use Magento \Framework \Registry ;
33
37
use Psr \Log \LoggerInterface as PsrLogger ;
34
38
use Magento \Framework \Exception \MailException ;
35
39
use Magento \Framework \Mail \Template \TransportBuilder ;
@@ -205,11 +209,10 @@ class AccountManagement implements AccountManagementInterface
205
209
* @param StoreManagerInterface $storeManager
206
210
* @param Random $mathRandom
207
211
* @param Validator $validator
208
- * @param \Magento\Customer\Api\Data\ ValidationResultsInterfaceFactory $validationResultsDataFactory
212
+ * @param ValidationResultsInterfaceFactory $validationResultsDataFactory
209
213
* @param AddressRepositoryInterface $addressRepository
210
214
* @param CustomerMetadataInterface $customerMetadataService
211
215
* @param CustomerRegistry $customerRegistry
212
- * @param \Magento\Framework\Url $url
213
216
* @param PsrLogger $logger
214
217
* @param Encryptor $encryptor
215
218
* @param ConfigShare $configShare
@@ -218,12 +221,12 @@ class AccountManagement implements AccountManagementInterface
218
221
* @param ScopeConfigInterface $scopeConfig
219
222
* @param TransportBuilder $transportBuilder
220
223
* @param DataObjectProcessor $dataProcessor
221
- * @param \Magento\Framework\ Registry $registry
224
+ * @param Registry $registry
222
225
* @param CustomerViewHelper $customerViewHelper
223
226
* @param DateTime $dateTime
224
227
* @param CustomerModel $customerModel
225
- * @param \Magento\Framework\ ObjectFactory $objectFactory
226
- * @param \Magento\Framework\Api\ ExtensibleDataObjectConverter $extensibleDataObjectConverter
228
+ * @param ObjectFactory $objectFactory
229
+ * @param ExtensibleDataObjectConverter $extensibleDataObjectConverter
227
230
*
228
231
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
229
232
*/
@@ -233,11 +236,10 @@ public function __construct(
233
236
StoreManagerInterface $ storeManager ,
234
237
Random $ mathRandom ,
235
238
Validator $ validator ,
236
- \ Magento \ Customer \ Api \ Data \ ValidationResultsInterfaceFactory $ validationResultsDataFactory ,
239
+ ValidationResultsInterfaceFactory $ validationResultsDataFactory ,
237
240
AddressRepositoryInterface $ addressRepository ,
238
241
CustomerMetadataInterface $ customerMetadataService ,
239
242
CustomerRegistry $ customerRegistry ,
240
- \Magento \Framework \Url $ url ,
241
243
PsrLogger $ logger ,
242
244
Encryptor $ encryptor ,
243
245
ConfigShare $ configShare ,
@@ -246,12 +248,12 @@ public function __construct(
246
248
ScopeConfigInterface $ scopeConfig ,
247
249
TransportBuilder $ transportBuilder ,
248
250
DataObjectProcessor $ dataProcessor ,
249
- \ Magento \ Framework \ Registry $ registry ,
251
+ Registry $ registry ,
250
252
CustomerViewHelper $ customerViewHelper ,
251
253
DateTime $ dateTime ,
252
254
CustomerModel $ customerModel ,
253
- \ Magento \ Framework \ ObjectFactory $ objectFactory ,
254
- \ Magento \ Framework \ Api \ ExtensibleDataObjectConverter $ extensibleDataObjectConverter
255
+ ObjectFactory $ objectFactory ,
256
+ ExtensibleDataObjectConverter $ extensibleDataObjectConverter
255
257
) {
256
258
$ this ->customerFactory = $ customerFactory ;
257
259
$ this ->eventManager = $ eventManager ;
@@ -614,18 +616,19 @@ public function changePasswordById($customerId, $currentPassword, $newPassword)
614
616
/**
615
617
* Change customer password.
616
618
*
617
- * @param string $email
619
+ * @param CustomerModel $customer
618
620
* @param string $currentPassword
619
621
* @param string $newPassword
620
622
* @return bool true on success
623
+ * @throws InputException
624
+ * @throws InvalidEmailOrPasswordException
621
625
*/
622
626
private function changePasswordForCustomer ($ customer , $ currentPassword , $ newPassword )
623
627
{
624
628
$ customerSecure = $ this ->customerRegistry ->retrieveSecureData ($ customer ->getId ());
625
629
$ hash = $ customerSecure ->getPasswordHash ();
626
630
if (!$ this ->encryptor ->validateHash ($ currentPassword , $ hash )) {
627
- throw new InvalidEmailOrPasswordException (
628
- __ ('The password doesn \'t match this account. ' ));
631
+ throw new InvalidEmailOrPasswordException (__ ('The password doesn \'t match this account. ' ));
629
632
}
630
633
$ customerSecure ->setRpToken (null );
631
634
$ customerSecure ->setRpTokenCreatedAt (null );
0 commit comments