Skip to content

Commit 13b4563

Browse files
committed
Merge branch 'ACP2E-1332' of https://github.com/magento-l3/magento2ce into PR-01-10-2023
2 parents 3f4cb98 + cfdc85b commit 13b4563

File tree

2 files changed

+4
-97
lines changed

2 files changed

+4
-97
lines changed

app/code/Magento/Customer/Controller/Account/Confirm.php

Lines changed: 4 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface;
1717
use Magento\Framework\App\Config\ScopeConfigInterface;
1818
use Magento\Framework\Controller\ResultFactory;
19-
use Magento\Framework\UrlFactory;
2019
use Magento\Framework\Exception\StateException;
20+
use Magento\Framework\UrlFactory;
2121
use Magento\Store\Model\ScopeInterface;
2222
use Magento\Store\Model\StoreManagerInterface;
2323

@@ -65,16 +65,6 @@ class Confirm extends AbstractAccount implements HttpGetActionInterface
6565
*/
6666
protected $session;
6767

68-
/**
69-
* @var \Magento\Framework\Stdlib\Cookie\CookieMetadataFactory
70-
*/
71-
private $cookieMetadataFactory;
72-
73-
/**
74-
* @var \Magento\Framework\Stdlib\Cookie\PhpCookieManager
75-
*/
76-
private $cookieMetadataManager;
77-
7868
/**
7969
* @param Context $context
8070
* @param Session $customerSession
@@ -105,38 +95,6 @@ public function __construct(
10595
parent::__construct($context);
10696
}
10797

108-
/**
109-
* Retrieve cookie manager
110-
*
111-
* @deprecated 101.0.0
112-
* @return \Magento\Framework\Stdlib\Cookie\PhpCookieManager
113-
*/
114-
private function getCookieManager()
115-
{
116-
if (!$this->cookieMetadataManager) {
117-
$this->cookieMetadataManager = \Magento\Framework\App\ObjectManager::getInstance()->get(
118-
\Magento\Framework\Stdlib\Cookie\PhpCookieManager::class
119-
);
120-
}
121-
return $this->cookieMetadataManager;
122-
}
123-
124-
/**
125-
* Retrieve cookie metadata factory
126-
*
127-
* @deprecated 101.0.0
128-
* @return \Magento\Framework\Stdlib\Cookie\CookieMetadataFactory
129-
*/
130-
private function getCookieMetadataFactory()
131-
{
132-
if (!$this->cookieMetadataFactory) {
133-
$this->cookieMetadataFactory = \Magento\Framework\App\ObjectManager::getInstance()->get(
134-
\Magento\Framework\Stdlib\Cookie\CookieMetadataFactory::class
135-
);
136-
}
137-
return $this->cookieMetadataFactory;
138-
}
139-
14098
/**
14199
* Confirm customer account by id and confirmation key
142100
*
@@ -161,15 +119,9 @@ public function execute()
161119
}
162120

163121
try {
164-
// log in and send greeting email
122+
//activate and send greeting email
165123
$customerEmail = $this->customerRepository->getById($customerId)->getEmail();
166-
$customer = $this->customerAccountManagement->activate($customerEmail, $key);
167-
$this->session->setCustomerDataAsLoggedIn($customer);
168-
if ($this->getCookieManager()->getCookie('mage-cache-sessid')) {
169-
$metadata = $this->getCookieMetadataFactory()->createCookieMetadata();
170-
$metadata->setPath('/');
171-
$this->getCookieManager()->deleteCookie('mage-cache-sessid', $metadata);
172-
}
124+
$this->customerAccountManagement->activate($customerEmail, $key);
173125
$this->messageManager->addSuccess($this->getSuccessMessage());
174126
$resultRedirect->setUrl($this->getSuccessRedirect());
175127
return $resultRedirect;
@@ -197,7 +149,7 @@ protected function getSuccessMessage()
197149
'If you are a registered VAT customer, please click <a href="%1">here</a> to enter your shipping address for proper VAT calculation.',
198150
$this->urlModel->getUrl('customer/address/edit')
199151
);
200-
// @codingStandardsIgnoreEnd
152+
// @codingStandardsIgnoreEnd
201153
} else {
202154
// @codingStandardsIgnoreStart
203155
$message = __(

app/code/Magento/Customer/Test/Unit/Controller/Account/ConfirmTest.php

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -347,38 +347,6 @@ public function testSuccessMessage(
347347
->method('getStore')
348348
->willReturn($this->storeMock);
349349

350-
$cookieMetadataManager = $this->getMockBuilder(PhpCookieManager::class)
351-
->disableOriginalConstructor()
352-
->getMock();
353-
$cookieMetadataManager->expects($this->once())
354-
->method('getCookie')
355-
->with('mage-cache-sessid')
356-
->willReturn(true);
357-
$cookieMetadataFactory = $this->getMockBuilder(CookieMetadataFactory::class)
358-
->disableOriginalConstructor()
359-
->getMock();
360-
$cookieMetadata = $this->getMockBuilder(CookieMetadata::class)
361-
->disableOriginalConstructor()
362-
->getMock();
363-
$cookieMetadataFactory->expects($this->once())
364-
->method('createCookieMetadata')
365-
->willReturn($cookieMetadata);
366-
$cookieMetadata->expects($this->once())
367-
->method('setPath')
368-
->with('/');
369-
$cookieMetadataManager->expects($this->once())
370-
->method('deleteCookie')
371-
->with('mage-cache-sessid', $cookieMetadata);
372-
373-
$refClass = new \ReflectionClass(Confirm::class);
374-
$cookieMetadataManagerProperty = $refClass->getProperty('cookieMetadataManager');
375-
$cookieMetadataManagerProperty->setAccessible(true);
376-
$cookieMetadataManagerProperty->setValue($this->model, $cookieMetadataManager);
377-
378-
$cookieMetadataFactoryProperty = $refClass->getProperty('cookieMetadataFactory');
379-
$cookieMetadataFactoryProperty->setAccessible(true);
380-
$cookieMetadataFactoryProperty->setValue($this->model, $cookieMetadataFactory);
381-
382350
$this->model->execute();
383351
}
384352

@@ -506,19 +474,6 @@ public function testSuccessRedirect(
506474
)
507475
->willReturn($isSetFlag);
508476

509-
$cookieMetadataManager = $this->getMockBuilder(PhpCookieManager::class)
510-
->disableOriginalConstructor()
511-
->getMock();
512-
$cookieMetadataManager->expects($this->once())
513-
->method('getCookie')
514-
->with('mage-cache-sessid')
515-
->willReturn(false);
516-
517-
$refClass = new \ReflectionClass(Confirm::class);
518-
$refProperty = $refClass->getProperty('cookieMetadataManager');
519-
$refProperty->setAccessible(true);
520-
$refProperty->setValue($this->model, $cookieMetadataManager);
521-
522477
$this->model->execute();
523478
}
524479

0 commit comments

Comments
 (0)