v1.1.0: How to fix the issue when the login as customer function no more work?

Created by Jane D, Modified on Tue, 07 Sep 2021 at 03:12 PM by Jane D

QUESTION:


I can easily replicate it on 2.4.2 due to this observer xxxxx/xxxxx/module-login-as-customer-frontend-ui/Plugin/InvalidateExpiredSessionPlugin.php as you can see BSS & Magento have separate tables Magento is looking on its own table and it failed to find logged in user so it will regenerate session.


If you pass above observer to your engineers they should find it:

$adminId = $this->getLoggedAsCustomerAdminId->execute();

$customerId = (int)$this->session->getCustomerId();

if ($adminId && $customerId) {

if (!$this->isLoginAsCustomerSessionActive->execute($customerId, $adminId)) {

$this->session->clearStorage();

$this->session->expireSessionCookie();

$this->session->regenerateId();

}

}


Please give me the guide to fix this?


ANSWER:


From Magento 2.4.1, Magento default supports the function login as customer so that please download the files below and overrides the current files on your site to get it worked properly as Magento default logic instead of using our module logic.


+ app/code/Bss/AdminPreview/Block/Adminhtml/Customer/Edit/Login.php

+ app/code/Bss/AdminPreview/Controller/Adminhtml/Customer/Login.php
+ app/code/Bss/AdminPreview/Helper/Data.php
+ app/code/Bss/AdminPreview/Model/Login.php


If you need any further assistance, please feel free to contact us. We'd be happy to support!  




Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article