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?


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

if($customerSession->isLoggedIn()) {

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

| improve this answer | |
  • How to know who is login? – Bong Channarith Jun 25 '18 at 5:59
  • If user jonh login in web, then he want log in to phone. How to verify jonh is loged? – Bong Channarith Jun 25 '18 at 6:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.