Skip to content

Commit

Permalink
Merge master into issue-3243
Browse files Browse the repository at this point in the history
  • Loading branch information
IrinaZhadzinets committed Jul 7, 2022
2 parents c37915e + 4b4f910 commit 282b6f9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Model/Resolver/CreateCustomer.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function resolve(
) {
$output = parent::resolve($field, $context, $info, $value, $args);

if (isset($args['input']['orderID']) && isset($output['customer']['id'])) {
if (isset($args['input']['orderID']) && !empty($args['input']['orderID']) && isset($output['customer']['id'])) {
$orderModel = $this->orderFactory->create()->loadByIncrementId($args['input']['orderID']);

$orderModel->setCustomerId($output['customer']['id']);
Expand Down
10 changes: 10 additions & 0 deletions src/Model/Resolver/ResetPassword.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
namespace ScandiPWA\CustomerGraphQl\Model\Resolver;

use Magento\Customer\Api\CustomerRepositoryInterface;
use Magento\Customer\Model\AuthenticationInterface;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\Exception\InputException;
use Magento\Framework\GraphQl\Config\Element\Field;
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
Expand Down Expand Up @@ -43,6 +45,11 @@ class ResetPassword implements ResolverInterface {
*/
protected $customerRepository;

/**
* @var AuthenticationInterface
*/
protected $authentication;

/**
* @var ConfirmCustomerByToken
*/
Expand All @@ -60,11 +67,13 @@ public function __construct(
Session $customerSession,
CustomerRepositoryInterface $customerRepository,
AccountManagementInterface $accountManagement,
AuthenticationInterface $authenctication,
ConfirmCustomerByToken $confirmByToken = null
) {
$this->session = $customerSession;
$this->accountManagement = $accountManagement;
$this->customerRepository = $customerRepository;
$this->authentication = $authenctication;
$this->confirmByToken = $confirmByToken;
}

Expand Down Expand Up @@ -109,6 +118,7 @@ public function resolve(
$this->confirmByToken->execute($resetPasswordToken);

$this->accountManagement->resetPassword($customerEmail, $resetPasswordToken, $password);
$this->authentication->unlock($customerId);
$this->session->unsRpToken();

return [ 'status' => self::STATUS_PASSWORD_UPDATED ];
Expand Down

0 comments on commit 282b6f9

Please sign in to comment.