File tree Expand file tree Collapse file tree 3 files changed +50
-117
lines changed Expand file tree Collapse file tree 3 files changed +50
-117
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Timpack \PwnedValidator \Plugin ;
4
+
5
+ use Magento \Customer \Api \AccountManagementInterface ;
6
+ use Magento \Customer \Api \Data \CustomerInterface ;
7
+ use Magento \Framework \Event \ManagerInterface ;
8
+
9
+ class AccountManagementPlugin
10
+ {
11
+ /**
12
+ * @var ManagerInterface
13
+ */
14
+ protected $ eventManager ;
15
+
16
+ /**
17
+ * AccountManagementPlugin constructor.
18
+ * @param ManagerInterface $eventManager
19
+ */
20
+ public function __construct (
21
+ ManagerInterface $ eventManager
22
+ ) {
23
+ $ this ->eventManager = $ eventManager ;
24
+ }
25
+
26
+ /**
27
+ * @param AccountManagementInterface $subject
28
+ * @param CustomerInterface $customer
29
+ * @param null $password
30
+ * @param string $redirectUrl
31
+ */
32
+ public function beforeCreateAccount (
33
+ AccountManagementInterface $ subject ,
34
+ CustomerInterface $ customer ,
35
+ $ password = null ,
36
+ $ redirectUrl = ''
37
+ ) {
38
+ if (!is_null ($ password )) {
39
+ $ this ->eventManager ->dispatch (
40
+ 'timpack_pwnedvalidator_check_password_strength ' ,
41
+ [
42
+ 'password ' => $ password ,
43
+ ]
44
+ );
45
+ }
46
+ }
47
+ }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 2
2
<config xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
3
3
xsi : noNamespaceSchemaLocation =" urn:magento:framework:ObjectManager/etc/config.xsd" >
4
4
<preference for =" Timpack\PwnedValidator\Api\ValidatorInterface" type =" Timpack\PwnedValidator\Model\Validator" />
5
- <preference for =" Magento\Customer\Model\AccountManagement"
6
- type =" Timpack\PwnedValidator\Rewrite\Model\AccountManagement" />
5
+ <type name =" Magento\Customer\Api\AccountManagementInterface" >
6
+ <plugin name =" timpack_pwnedvalidator_magento_customer_api_accountmanagementinterface" type =" Timpack\PwnedValidator\Plugin\AccountManagementPlugin" />
7
+ </type >
7
8
<type name =" Timpack\PwnedValidator\Api\ValidatorInterface" >
8
9
<arguments >
9
10
<argument name =" httpClient" xsi : type =" object" >Magento\Framework\HTTP\Client\Curl</argument >
You can’t perform that action at this time.
0 commit comments