Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force magento to logout

Tags:

magento

I am working in magento community-1.6. I need to clear session or logout the current user at one stage of my site process. How will I do this.?

like image 962
Sankar Subburaj Avatar asked Dec 10 '11 07:12

Sankar Subburaj


People also ask

How to logout customer programmatically in Magento 2?

You need to call logout() function from above class dependency. Call customerLogout() function from above file to programmatically log out a customer from the current session.

How do I check if a file exists in Magento 2?

You can check any physical file is exist or not at a specific location in Magento directory by Magento\Framework\Filesystem\Driver\File class. You can use Magento 2 native class to check file is exist or not instead of the core PHP method. Call from a template file, echo $block->checkFileExists();

How do I log out of Magento 2?

You can simply destroy session to logout the customer. /** @var Magento\Customer\Model\Session; */ $session->destroy(); And than redirect page to login page.


1 Answers

Mage::getSingleton('customer/session')->logout();
like image 161
Sankar Subburaj Avatar answered Sep 22 '22 23:09

Sankar Subburaj