Skip to content

Commit 0b2b1bb

Browse files
ENGCOM-9057: Only add referrer param to login url if referrer is a GET request #32891
2 parents 7371b0a + 0a6d70e commit 0b2b1bb

File tree

2 files changed

+20
-0
lines changed
  • app/code/Magento/Customer/Model
  • dev/tests/integration/testsuite/Magento/Customer/Controller/Account

2 files changed

+20
-0
lines changed

app/code/Magento/Customer/Model/Url.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ public function getLoginUrlParams()
120120
ScopeInterface::SCOPE_STORE
121121
)
122122
&& !$this->customerSession->getNoReferer()
123+
&& $this->request->isGet()
123124
) {
124125
$referer = $this->urlBuilder->getUrl('*/*/*', ['_current' => true, '_use_rewrite' => true]);
125126
$referer = $this->urlEncoder->encode($referer);

dev/tests/integration/testsuite/Magento/Customer/Controller/Account/LoginPostTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,25 @@ public function testLoginWithRedirectToDashboardDisabled(): void
144144
$this->assertRedirect($this->stringContains('test_redirect'));
145145
}
146146

147+
/**
148+
* @magentoConfigFixture current_store customer/startup/redirect_dashboard 0
149+
* @magentoConfigFixture current_store customer/captcha/enable 0
150+
*
151+
* @magentoDataFixture Magento/Customer/_files/customer.php
152+
*
153+
* @return void
154+
*/
155+
public function testLoginFailureWithRedirectToDashboardDisabled(): void
156+
{
157+
$this->prepareRequest('customer@example.com', 'incorrect');
158+
$this->dispatch('customer/account/loginPost');
159+
$this->assertFalse($this->session->isLoggedIn());
160+
$this->assertRedirect($this->logicalAnd(
161+
$this->stringContains('customer/account/login'),
162+
$this->logicalnot($this->stringContains('referer'))
163+
));
164+
}
165+
147166
/**
148167
* @magentoConfigFixture current_store customer/startup/redirect_dashboard 0
149168
* @magentoConfigFixture current_store customer/captcha/enable 0

0 commit comments

Comments
 (0)