|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace Timpack\PwnedValidator\Rewrite\Model; |
| 4 | + |
| 5 | +use Magento\Customer\Api\AddressRepositoryInterface; |
| 6 | +use Magento\Customer\Api\CustomerMetadataInterface; |
| 7 | +use Magento\Customer\Api\CustomerRepositoryInterface; |
| 8 | +use Magento\Customer\Api\Data\ValidationResultsInterfaceFactory; |
| 9 | +use Magento\Customer\Helper\View as CustomerViewHelper; |
| 10 | +use Magento\Customer\Model\Config\Share as ConfigShare; |
| 11 | +use Magento\Customer\Model\Customer as CustomerModel; |
| 12 | +use Magento\Customer\Model\Customer\CredentialsValidator; |
| 13 | +use Magento\Customer\Model\CustomerFactory; |
| 14 | +use Magento\Customer\Model\CustomerRegistry; |
| 15 | +use Magento\Customer\Model\Metadata\Validator; |
| 16 | +use Magento\Customer\Model\ResourceModel\Visitor\CollectionFactory; |
| 17 | +use Magento\Framework\Api\ExtensibleDataObjectConverter; |
| 18 | +use Magento\Framework\App\Config\ScopeConfigInterface; |
| 19 | +use Magento\Framework\DataObjectFactory as ObjectFactory; |
| 20 | +use Magento\Framework\Encryption\EncryptorInterface as Encryptor; |
| 21 | +use Magento\Framework\Event\ManagerInterface; |
| 22 | +use Magento\Framework\Intl\DateTimeFactory; |
| 23 | +use Magento\Framework\Mail\Template\TransportBuilder; |
| 24 | +use Magento\Framework\Math\Random; |
| 25 | +use Magento\Framework\Reflection\DataObjectProcessor; |
| 26 | +use Magento\Framework\Registry; |
| 27 | +use Magento\Framework\Session\SaveHandlerInterface; |
| 28 | +use Magento\Framework\Session\SessionManagerInterface; |
| 29 | +use Magento\Framework\Stdlib\DateTime; |
| 30 | +use Magento\Framework\Stdlib\StringUtils as StringHelper; |
| 31 | +use Magento\Store\Model\StoreManagerInterface; |
| 32 | +use Psr\Log\LoggerInterface as PsrLogger; |
| 33 | + |
| 34 | +class AccountManagement extends \Magento\Customer\Model\AccountManagement |
| 35 | +{ |
| 36 | + /** |
| 37 | + * @var ManagerInterface |
| 38 | + */ |
| 39 | + private $eventManager; |
| 40 | + |
| 41 | + public function __construct( |
| 42 | + CustomerFactory $customerFactory, |
| 43 | + ManagerInterface $eventManager, |
| 44 | + StoreManagerInterface $storeManager, |
| 45 | + Random $mathRandom, |
| 46 | + Validator $validator, |
| 47 | + ValidationResultsInterfaceFactory $validationResultsDataFactory, |
| 48 | + AddressRepositoryInterface $addressRepository, |
| 49 | + CustomerMetadataInterface $customerMetadataService, |
| 50 | + CustomerRegistry $customerRegistry, |
| 51 | + PsrLogger $logger, |
| 52 | + Encryptor $encryptor, |
| 53 | + ConfigShare $configShare, |
| 54 | + StringHelper $stringHelper, |
| 55 | + CustomerRepositoryInterface $customerRepository, |
| 56 | + ScopeConfigInterface $scopeConfig, |
| 57 | + TransportBuilder $transportBuilder, |
| 58 | + DataObjectProcessor $dataProcessor, |
| 59 | + Registry $registry, |
| 60 | + CustomerViewHelper $customerViewHelper, |
| 61 | + DateTime $dateTime, |
| 62 | + CustomerModel $customerModel, |
| 63 | + ObjectFactory $objectFactory, |
| 64 | + ExtensibleDataObjectConverter $extensibleDataObjectConverter, |
| 65 | + CredentialsValidator $credentialsValidator = null, |
| 66 | + DateTimeFactory $dateTimeFactory = null, |
| 67 | + SessionManagerInterface $sessionManager = null, |
| 68 | + SaveHandlerInterface $saveHandler = null, |
| 69 | + CollectionFactory $visitorCollectionFactory = null |
| 70 | + ) |
| 71 | + { |
| 72 | + parent::__construct( |
| 73 | + $customerFactory, |
| 74 | + $eventManager, |
| 75 | + $storeManager, |
| 76 | + $mathRandom, |
| 77 | + $validator, |
| 78 | + $validationResultsDataFactory, |
| 79 | + $addressRepository, |
| 80 | + $customerMetadataService, |
| 81 | + $customerRegistry, |
| 82 | + $logger, |
| 83 | + $encryptor, |
| 84 | + $configShare, |
| 85 | + $stringHelper, |
| 86 | + $customerRepository, |
| 87 | + $scopeConfig, |
| 88 | + $transportBuilder, |
| 89 | + $dataProcessor, |
| 90 | + $registry, |
| 91 | + $customerViewHelper, |
| 92 | + $dateTime, |
| 93 | + $customerModel, |
| 94 | + $objectFactory, |
| 95 | + $extensibleDataObjectConverter, |
| 96 | + $credentialsValidator, |
| 97 | + $dateTimeFactory, |
| 98 | + $sessionManager, |
| 99 | + $saveHandler, |
| 100 | + $visitorCollectionFactory |
| 101 | + ); |
| 102 | + $this->eventManager = $eventManager; |
| 103 | + } |
| 104 | + |
| 105 | + /** |
| 106 | + * @param string $password |
| 107 | + * @throws \Magento\Framework\Exception\InputException |
| 108 | + * @return void |
| 109 | + */ |
| 110 | + protected function checkPasswordStrength($password) |
| 111 | + { |
| 112 | + parent::checkPasswordStrength($password); |
| 113 | + $this->eventManager->dispatch('timpack_pwnedvalidator_check_password_strength', ['password' => $password]); |
| 114 | + } |
| 115 | +} |
0 commit comments