Skip to content

Commit 676e037

Browse files
MC-32864: Forgot Password redirect issue - with shared website accounts
1 parent ebcadea commit 676e037

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
use Magento\Customer\Api\AccountManagementInterface;
9+
use Magento\Customer\Api\CustomerMetadataInterface;
10+
use Magento\Customer\Api\Data\CustomerInterface;
11+
use Magento\Customer\Model\Data\CustomerFactory;
12+
use Magento\Customer\Model\GroupManagement;
13+
use Magento\Eav\Model\AttributeRepository;
14+
use Magento\TestFramework\Helper\Bootstrap;
15+
16+
require __DIR__ . '/../../../Magento/Store/_files/second_website_with_two_stores.php';
17+
18+
$objectManager = Bootstrap::getObjectManager();
19+
/** @var AccountManagementInterface $accountManagment */
20+
$accountManagment = $objectManager->get(AccountManagementInterface::class);
21+
/** @var CustomerFactory $customerFactory */
22+
$customerFactory = $objectManager->get(CustomerFactory::class);
23+
/** @var AttributeRepository $attributeRepository */
24+
$attributeRepository = $objectManager->get(AttributeRepository::class);
25+
$gender = $attributeRepository->get(CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER, CustomerInterface::GENDER)
26+
->getSource()->getOptionId('Male');
27+
$defaultGroupId = $objectManager->get(GroupManagement::class)->getDefaultGroup($store->getStoreId())->getId();
28+
29+
$customer = $customerFactory->create();
30+
$customer->setWebsiteId($websiteId)
31+
->setEmail('customer@example.com')
32+
->setGroupId($defaultGroupId)
33+
->setStoreId($store->getStoreId())
34+
->setFirstname('John')
35+
->setLastname('Smith')
36+
->setDefaultBilling(1)
37+
->setDefaultShipping(1)
38+
->setGender($gender);
39+
40+
$accountManagment->createAccount($customer, 'Apassword1');
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
use Magento\Customer\Api\CustomerRepositoryInterface;
9+
use Magento\Framework\Exception\NoSuchEntityException;
10+
use Magento\TestFramework\Helper\Bootstrap;
11+
12+
require __DIR__ . '/../../../Magento/Store/_files/second_website_with_two_stores_rollback.php';
13+
14+
$objectManager = Bootstrap::getObjectManager();
15+
/** @var CustomerRepositoryInterface $customerRepository */
16+
$customerRepository = $objectManager->get(CustomerRepositoryInterface::class);
17+
$registry->unregister('isSecureArea');
18+
$registry->register('isSecureArea', true);
19+
20+
try {
21+
$customer = $customerRepository->get('customer@example.com', $websiteId);
22+
$customerRepository->delete($customer);
23+
} catch (NoSuchEntityException $e) {
24+
//customer already deleted
25+
}
26+
27+
$registry->unregister('isSecureArea');
28+
$registry->register('isSecureArea', false);

0 commit comments

Comments
 (0)