Skip to content

Commit 3889286

Browse files
committed
magento-commerce/magento2-login-as-customer#171: Force customer unlogin during admin loglout without additional MySQL queries
1 parent 76c4198 commit 3889286

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

app/code/Magento/LoginAsCustomer/Plugin/AdminLogoutPlugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function __construct(
4646
public function beforeLogout(Auth $subject): void
4747
{
4848
$user = $subject->getUser();
49-
if ($this->config->isEnabled() && $user) {
49+
if ($this->config->isEnabled() && $user && $user->getIsLoggedAsCustomer()) {
5050
$userId = (int)$user->getId();
5151
$this->deleteAuthenticationDataForUser->execute($userId);
5252
}

app/code/Magento/LoginAsCustomer/etc/config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<default>
1111
<login_as_customer>
1212
<general>
13-
<enabled>0</enabled>
13+
<enabled>1</enabled>
1414
<store_view_manual_choice_enabled>0</store_view_manual_choice_enabled>
1515
<authentication_data_expiration_time>60</authentication_data_expiration_time>
1616
</general>

app/code/Magento/LoginAsCustomerFrontendUi/CustomerData/LoginAsCustomerUi.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function __construct(
4949
*/
5050
public function getSectionData(): array
5151
{
52-
if (!$this->customerSession->getCustomerId()) {
52+
if (!$this->customerSession->getCustomerId() || !$this->customerSession->getLoggedAsCustomerAdmindId()) {
5353
return [];
5454
}
5555

0 commit comments

Comments
 (0)