Skip to content

Commit 6b7b67a

Browse files
committed
ACP2E-1972: revert loginpost
1 parent c980417 commit 6b7b67a

File tree

2 files changed

+3
-26
lines changed

2 files changed

+3
-26
lines changed

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

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,22 @@
1313
use Magento\Customer\Api\AccountManagementInterface;
1414
use Magento\Customer\Model\Url as CustomerUrl;
1515
use Magento\Framework\App\CsrfAwareActionInterface;
16-
use Magento\Framework\App\ObjectManager;
1716
use Magento\Framework\App\Request\InvalidRequestException;
1817
use Magento\Framework\App\RequestInterface;
1918
use Magento\Framework\Controller\Result\Redirect;
2019
use Magento\Framework\Exception\EmailNotConfirmedException;
2120
use Magento\Framework\Exception\AuthenticationException;
2221
use Magento\Framework\Data\Form\FormKey\Validator;
2322
use Magento\Framework\Exception\LocalizedException;
23+
use Magento\Framework\Exception\State\UserLockedException;
2424
use Magento\Framework\App\Config\ScopeConfigInterface;
2525
use Magento\Customer\Controller\AbstractAccount;
2626
use Magento\Framework\Phrase;
27-
use Magento\Framework\Session\Generic;
2827

2928
/**
3029
* Post login customer action.
3130
*
3231
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
33-
* @SuppressWarnings(PHPMD.ElseExpression)
34-
* phpcs:disable Magento2.Annotation.MethodAnnotationStructure.InvalidDeprecatedTagUsage
3532
*/
3633
class LoginPost extends AbstractAccount implements CsrfAwareActionInterface, HttpPostActionInterface
3734
{
@@ -75,35 +72,27 @@ class LoginPost extends AbstractAccount implements CsrfAwareActionInterface, Htt
7572
*/
7673
private $customerUrl;
7774

78-
/**
79-
* @var Generic
80-
*/
81-
private $generic;
82-
8375
/**
8476
* @param Context $context
8577
* @param Session $customerSession
8678
* @param AccountManagementInterface $customerAccountManagement
8779
* @param CustomerUrl $customerHelperData
8880
* @param Validator $formKeyValidator
8981
* @param AccountRedirect $accountRedirect
90-
* @param Generic $generic
9182
*/
9283
public function __construct(
9384
Context $context,
9485
Session $customerSession,
9586
AccountManagementInterface $customerAccountManagement,
9687
CustomerUrl $customerHelperData,
9788
Validator $formKeyValidator,
98-
AccountRedirect $accountRedirect,
99-
Generic $generic = null
89+
AccountRedirect $accountRedirect
10090
) {
10191
$this->session = $customerSession;
10292
$this->customerAccountManagement = $customerAccountManagement;
10393
$this->customerUrl = $customerHelperData;
10494
$this->formKeyValidator = $formKeyValidator;
10595
$this->accountRedirect = $accountRedirect;
106-
$this->generic = $generic ?? ObjectManager::getInstance()->get(Generic::class);
10796
parent::__construct($context);
10897
}
10998

@@ -199,7 +188,6 @@ public function execute()
199188
$login = $this->getRequest()->getPost('login');
200189
if (!empty($login['username']) && !empty($login['password'])) {
201190
try {
202-
$this->generic->setVisitorData([]);
203191
$customer = $this->customerAccountManagement->authenticate($login['username'], $login['password']);
204192
$this->session->setCustomerDataAsLoggedIn($customer);
205193
if ($this->getCookieManager()->getCookie('mage-cache-sessid')) {

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

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
use Magento\Framework\Exception\EmailNotConfirmedException;
2525
use Magento\Framework\Exception\State\UserLockedException;
2626
use Magento\Framework\Message\ManagerInterface;
27-
use Magento\Framework\Session\Generic;
2827
use Magento\Framework\Stdlib\Cookie\CookieMetadata;
2928
use Magento\Framework\Stdlib\Cookie\CookieMetadataFactory;
3029
use Magento\Framework\Stdlib\Cookie\PhpCookieManager;
@@ -103,11 +102,6 @@ class LoginPostTest extends TestCase
103102
*/
104103
protected $scopeConfig;
105104

106-
/**
107-
* @var Generic|MockObject
108-
*/
109-
private $generic;
110-
111105
protected function setUp(): void
112106
{
113107
$this->prepareContext();
@@ -141,18 +135,13 @@ protected function setUp(): void
141135
$this->scopeConfig = $this->getMockBuilder(ScopeConfigInterface::class)
142136
->getMockForAbstractClass();
143137

144-
$this->generic = $this->getMockBuilder(Generic::class)
145-
->disableOriginalConstructor()
146-
->getMock();
147-
148138
$this->controller = new LoginPost(
149139
$this->context,
150140
$this->session,
151141
$this->accountManagement,
152142
$this->url,
153143
$this->formkeyValidator,
154-
$this->accountRedirect,
155-
$this->generic
144+
$this->accountRedirect
156145
);
157146
$reflection = new \ReflectionClass(get_class($this->controller));
158147
$reflectionProperty = $reflection->getProperty('scopeConfig');

0 commit comments

Comments
 (0)