-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Creating Customer without password is directly confirmed #14492
- Loading branch information
Maksym Novik
committed
May 16, 2019
1 parent
211dd25
commit 4e11099
Showing
6 changed files
with
247 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
app/code/Magento/Customer/Model/ForgotPasswordToken/ConfirmCustomerByToken.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\Customer\Model\ForgotPasswordToken; | ||
|
||
use Magento\Customer\Api\CustomerRepositoryInterface; | ||
|
||
/** | ||
* Confirm customer by reset password token | ||
*/ | ||
class ConfirmCustomerByToken | ||
{ | ||
/** | ||
* @var GetCustomerByToken | ||
*/ | ||
private $getByToken; | ||
|
||
/** | ||
* @var CustomerRepositoryInterface | ||
*/ | ||
private $customerRepository; | ||
|
||
/** | ||
* ConfirmByToken constructor. | ||
* | ||
* @param GetCustomerByToken $getByToken | ||
* @param CustomerRepositoryInterface $customerRepository | ||
*/ | ||
public function __construct( | ||
GetCustomerByToken $getByToken, | ||
CustomerRepositoryInterface $customerRepository | ||
) { | ||
$this->getByToken = $getByToken; | ||
$this->customerRepository = $customerRepository; | ||
} | ||
|
||
/** | ||
* Confirm customer account my rp_token | ||
* | ||
* @param string $resetPasswordToken | ||
* | ||
* @return void | ||
* @throws \Magento\Framework\Exception\LocalizedException | ||
*/ | ||
public function execute(string $resetPasswordToken): void | ||
{ | ||
$customer = $this->getByToken->execute($resetPasswordToken); | ||
if ($customer->getConfirmation()) { | ||
$this->customerRepository->save( | ||
$customer->setConfirmation(null) | ||
); | ||
} | ||
} | ||
} |
Oops, something went wrong.