Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-customer
Observer
UpgradeCustomerPasswordObserver.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\Customer\Observer
;
8
9
use
Magento\Framework\Encryption\EncryptorInterface
;
10
use
Magento\Framework\Event\ObserverInterface
;
11
use
Magento\Customer\Api\CustomerRepositoryInterface
;
12
use
Magento\Customer\Model\CustomerRegistry
;
13
14
class
UpgradeCustomerPasswordObserver
implements
ObserverInterface
15
{
21
protected
$encryptor
;
22
26
private
$customerRegistry;
27
31
private
$customerRepository;
32
38
public
function
__construct
(
39
EncryptorInterface
$encryptor
,
40
CustomerRegistry
$customerRegistry,
41
CustomerRepositoryInterface
$customerRepository
42
) {
43
$this->encryptor =
$encryptor
;
44
$this->customerRegistry =
$customerRegistry
;
45
$this->customerRepository =
$customerRepository
;
46
}
47
54
public
function
execute
(\
Magento
\Framework\Event\
Observer
$observer
)
55
{
56
$password =
$observer
->getEvent()->getData(
'password'
);
58
$model
=
$observer
->getEvent()->getData(
'model'
);
59
$customer
= $this->customerRepository->getById(
$model
->getId());
60
$customerSecure = $this->customerRegistry->retrieveSecureData(
$model
->getId());
61
62
if
(!$this->encryptor->validateHashVersion($customerSecure->getPasswordHash(),
true
)) {
63
$customerSecure->setPasswordHash($this->encryptor->getHash($password,
true
));
64
$this->customerRepository->save(
$customer
);
65
}
66
}
67
}
$customer
$customer
Definition:
customers.php:11
Magento\Customer\Observer\UpgradeCustomerPasswordObserver
Definition:
UpgradeCustomerPasswordObserver.php:14
$model
$model
Definition:
enable_catalog_product_reindex_schedule.php:9
Magento\Framework\Event\ObserverInterface
Definition:
ObserverInterface.php:16
Magento\Customer\Observer\UpgradeCustomerPasswordObserver\$encryptor
$encryptor
Definition:
UpgradeCustomerPasswordObserver.php:21
Magento\Customer\Observer
Definition:
AfterAddressSaveObserver.php:7
$customerRepository
$customerRepository
Definition:
quote_with_address.php:20
Magento\Customer\Observer\UpgradeCustomerPasswordObserver\__construct
__construct(EncryptorInterface $encryptor, CustomerRegistry $customerRegistry, CustomerRepositoryInterface $customerRepository)
Definition:
UpgradeCustomerPasswordObserver.php:38
Magento\Framework\Encryption\EncryptorInterface
Definition:
EncryptorInterface.php:14
$observer
$observer
Definition:
second_website_with_second_currency.php:38
Magento\Customer\Api\CustomerRepositoryInterface
Definition:
CustomerRepositoryInterface.php:15
Magento
$customerRegistry
$customerRegistry
Definition:
customers.php:12
Magento\Customer\Model\CustomerRegistry
Definition:
CustomerRegistry.php:17
Magento\Framework\Event\ObserverInterface\execute
execute(Observer $observer)
Magento\Framework\Event\Observer
Definition:
Observer.php:14