Skip to content

Commit 29621ba

Browse files
committed
ISSUE-27954: Forgot password save user only one column
1 parent 4a8f99d commit 29621ba

File tree

3 files changed

+24
-10
lines changed

3 files changed

+24
-10
lines changed

app/code/Magento/Customer/Model/ForgotPasswordToken/ConfirmCustomerByToken.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace Magento\Customer\Model\ForgotPasswordToken;
99

10-
use Magento\Customer\Api\CustomerRepositoryInterface;
10+
use Magento\Customer\Model\ResourceModel\Customer as CustomerResource;
1111

1212
/**
1313
* Confirm customer by reset password token
@@ -20,22 +20,22 @@ class ConfirmCustomerByToken
2020
private $getByToken;
2121

2222
/**
23-
* @var CustomerRepositoryInterface
23+
* @var CustomerResource
2424
*/
25-
private $customerRepository;
25+
private $customerResource;
2626

2727
/**
2828
* ConfirmByToken constructor.
2929
*
3030
* @param GetCustomerByToken $getByToken
31-
* @param CustomerRepositoryInterface $customerRepository
31+
* @param CustomerResource $customerResource
3232
*/
3333
public function __construct(
3434
GetCustomerByToken $getByToken,
35-
CustomerRepositoryInterface $customerRepository
35+
CustomerResource $customerResource
3636
) {
3737
$this->getByToken = $getByToken;
38-
$this->customerRepository = $customerRepository;
38+
$this->customerResource = $customerResource;
3939
}
4040

4141
/**
@@ -50,9 +50,7 @@ public function execute(string $resetPasswordToken): void
5050
{
5151
$customer = $this->getByToken->execute($resetPasswordToken);
5252
if ($customer->getConfirmation()) {
53-
$this->customerRepository->save(
54-
$customer->setConfirmation(null)
55-
);
53+
$this->customerResource->updateColumn($customer->getId(), 'confirmation', null);
5654
}
5755
}
5856
}

app/code/Magento/Customer/Model/ForgotPasswordToken/GetCustomerByToken.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function __construct(
5454
* @throws NoSuchEntityException
5555
* @throws \Magento\Framework\Exception\LocalizedException
5656
*/
57-
public function execute(string $resetPasswordToken):CustomerInterface
57+
public function execute(string $resetPasswordToken): CustomerInterface
5858
{
5959
$this->searchCriteriaBuilder->addFilter(
6060
'rp_token',

app/code/Magento/Customer/Model/ResourceModel/Customer.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,4 +403,20 @@ public function changeResetPasswordLinkToken(\Magento\Customer\Model\Customer $c
403403
}
404404
return $this;
405405
}
406+
407+
/**
408+
* @param int $customerId
409+
* @param string $column
410+
* @param string $value
411+
*/
412+
public function updateColumn($customerId, $column, $value)
413+
{
414+
$this->getConnection()->update(
415+
$this->getTable('customer_entity'),
416+
[$column => $value],
417+
[$this->getEntityIdField() . ' = ?' => $customerId]
418+
);
419+
420+
return $this;
421+
}
406422
}

0 commit comments

Comments
 (0)