diff --git a/app/code/Magento/LoginAsCustomer/Plugin/AdminLogoutPlugin.php b/app/code/Magento/LoginAsCustomer/Plugin/AdminLogoutPlugin.php index 3b8d26129a91e..f473dcebcf9ea 100644 --- a/app/code/Magento/LoginAsCustomer/Plugin/AdminLogoutPlugin.php +++ b/app/code/Magento/LoginAsCustomer/Plugin/AdminLogoutPlugin.php @@ -45,7 +45,7 @@ public function __construct( */ public function beforeLogout(Auth $subject): void { - if ($this->config->isEnabled()) { + if ($this->config->isEnabled() && $subject->getUser()) { $userId = (int)$subject->getUser()->getId(); $this->deleteAuthenticationDataForUser->execute($userId); } diff --git a/app/code/Magento/LoginAsCustomer/etc/config.xml b/app/code/Magento/LoginAsCustomer/etc/config.xml index 936ae1ff2f05d..7e39cc39145eb 100644 --- a/app/code/Magento/LoginAsCustomer/etc/config.xml +++ b/app/code/Magento/LoginAsCustomer/etc/config.xml @@ -10,7 +10,7 @@ - 0 + 1 0 60