File tree Expand file tree Collapse file tree 4 files changed +92
-1
lines changed
app/code/Magento/AdminAdobeIms Expand file tree Collapse file tree 4 files changed +92
-1
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+
7
+ declare (strict_types=1 );
8
+
9
+ namespace Magento \AdminAdobeIms \Plugin ;
10
+
11
+ use Magento \AdminAdobeIms \Service \ImsConfig ;
12
+ use Magento \User \Model \Backend \Config \ObserverConfig ;
13
+
14
+ class DisableForcedPasswordChangePlugin
15
+ {
16
+ /** @var ImsConfig */
17
+ private ImsConfig $ imsConfig ;
18
+
19
+ /**
20
+ * @param ImsConfig $imsConfig
21
+ */
22
+ public function __construct (
23
+ ImsConfig $ imsConfig
24
+ ) {
25
+ $ this ->imsConfig = $ imsConfig ;
26
+ }
27
+
28
+ /**
29
+ * Disable forced password change when our module is active
30
+ *
31
+ * @param ObserverConfig $subject
32
+ * @param bool $result
33
+ * @return bool
34
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
35
+ */
36
+ public function afterIsPasswordChangeForced (ObserverConfig $ subject , bool $ result ): bool
37
+ {
38
+ if ($ this ->imsConfig ->enabled () === false ) {
39
+ return $ result ;
40
+ }
41
+ return false ;
42
+ }
43
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+
7
+ declare (strict_types=1 );
8
+
9
+ namespace Magento \AdminAdobeIms \Plugin ;
10
+
11
+ use Magento \AdminAdobeIms \Service \ImsConfig ;
12
+ use Magento \User \Model \Backend \Config \ObserverConfig ;
13
+
14
+ class DisablePasswordResetPlugin
15
+ {
16
+ /** @var ImsConfig */
17
+ private ImsConfig $ imsConfig ;
18
+
19
+ /**
20
+ * @param ImsConfig $imsConfig
21
+ */
22
+ public function __construct (
23
+ ImsConfig $ imsConfig
24
+ ) {
25
+ $ this ->imsConfig = $ imsConfig ;
26
+ }
27
+
28
+ /**
29
+ * Since the password reset module treats 0 as disabled we can just return 0 when our module is enabled
30
+ *
31
+ * @param ObserverConfig $subject
32
+ * @param float $result
33
+ * @return float
34
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
35
+ */
36
+ public function afterGetAdminPasswordLifetime (ObserverConfig $ subject , float $ result ): float
37
+ {
38
+ if ($ this ->imsConfig ->enabled () === false ) {
39
+ return $ result ;
40
+ }
41
+ return 0 ;
42
+ }
43
+ }
Original file line number Diff line number Diff line change @@ -134,4 +134,3 @@ Open:
134
134
2 . Validate that when disabled the fields work again,
135
135
3 . Update Wiki
136
136
4 . Functional tests
137
- 5 . Test user with no password, but module disable with POST Request and API call
Original file line number Diff line number Diff line change 58
58
<plugin name =" remove_user_validation_rules"
59
59
type =" Magento\AdminAdobeIms\Plugin\RemoveUserValidationRulesPlugin" />
60
60
</type >
61
+ <type name =" Magento\User\Model\Backend\Config\ObserverConfig" >
62
+ <plugin name =" disable_password_reset"
63
+ type =" Magento\AdminAdobeIms\Plugin\DisablePasswordResetPlugin" />
64
+ <plugin name =" disable_forced_password_change"
65
+ type =" Magento\AdminAdobeIms\Plugin\DisableForcedPasswordChangePlugin" />
66
+ </type >
61
67
</config >
You can’t perform that action at this time.
0 commit comments