0

Using Magento 2.2, I need to allow customer login only one device at a time. Ex. if the customer is already logged in the computer, but user tries to log in with a smartphone, the Magento will disconnect them from the computer?

1 Answer 1

0

For check user login or not :

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$customerSession = $objectManager->get('Magento\Customer\Model\Session');
if($customerSession->isLoggedIn()) {
   // login action
}

To check in controller

$this->_objectManager->get('Magento\Customer\Model\Session');
if($customerSession->isLoggedIn()) {
}

As based on this you can check where customer login or not and put condition according to your requirement.

2
  • How to know who is login? Jun 25, 2018 at 5:59
  • If user jonh login in web, then he want log in to phone. How to verify jonh is loged? Jun 25, 2018 at 6:06

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .