Skip to content

Commit 0feaf3f

Browse files
committed
V1/customers/password endpoint security
1 parent 6a5060a commit 0feaf3f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

app/code/Magento/Security/Model/Plugin/AccountManagement.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Security\Model\Plugin;
79

810
use Magento\Customer\Model\AccountManagement as AccountManagementOriginal;
11+
use Magento\Framework\App\Area;
912
use Magento\Framework\App\ObjectManager;
1013
use Magento\Framework\Config\ScopeInterface;
1114
use Magento\Framework\Exception\SecurityViolationException;
@@ -58,6 +61,8 @@ public function __construct(
5861
}
5962

6063
/**
64+
* Security check before reset password
65+
*
6166
* @param AccountManagementOriginal $accountManagement
6267
* @param string $email
6368
* @param string $template
@@ -73,8 +78,10 @@ public function beforeInitiatePasswordReset(
7378
$template,
7479
$websiteId = null
7580
) {
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)) {
7885
$this->securityManager->performSecurityCheck(
7986
$this->passwordRequestEvent,
8087
$email

0 commit comments

Comments
 (0)