3
3
* Copyright © Magento, Inc. All rights reserved.
4
4
* See COPYING.txt for license details.
5
5
*/
6
+ declare (strict_types=1 );
7
+
6
8
namespace Magento \Security \Model \Plugin ;
7
9
8
10
use Magento \Customer \Model \AccountManagement as AccountManagementOriginal ;
11
+ use Magento \Framework \App \Area ;
9
12
use Magento \Framework \App \ObjectManager ;
10
13
use Magento \Framework \Config \ScopeInterface ;
11
14
use Magento \Framework \Exception \SecurityViolationException ;
@@ -58,6 +61,8 @@ public function __construct(
58
61
}
59
62
60
63
/**
64
+ * Security check before reset password
65
+ *
61
66
* @param AccountManagementOriginal $accountManagement
62
67
* @param string $email
63
68
* @param string $template
@@ -73,8 +78,10 @@ public function beforeInitiatePasswordReset(
73
78
$ template ,
74
79
$ websiteId = null
75
80
) {
76
- if ($ this ->scope ->getCurrentScope () == \Magento \Framework \App \Area::AREA_FRONTEND
77
- || $ this ->passwordRequestEvent == PasswordResetRequestEvent::ADMIN_PASSWORD_RESET_REQUEST ) {
81
+ if ($ this ->scope ->getCurrentScope () == Area::AREA_FRONTEND
82
+ || $ this ->passwordRequestEvent == PasswordResetRequestEvent::ADMIN_PASSWORD_RESET_REQUEST
83
+ || ($ this ->scope ->getCurrentScope () == Area::AREA_WEBAPI_REST
84
+ && $ this ->passwordRequestEvent == PasswordResetRequestEvent::CUSTOMER_PASSWORD_RESET_REQUEST )) {
78
85
$ this ->securityManager ->performSecurityCheck (
79
86
$ this ->passwordRequestEvent ,
80
87
$ email
0 commit comments