Magento - Force admin user log out
magento, magento-1.7
Solution
I was able to logout admin users with the following snippet
$adminSession = Mage::getSingleton('admin/session');
$adminSession->unsetAll();
$adminSession->getCookie()->delete($adminSession->getSessionName());
Problem
I am writing a module for Magento that only allows users to login from specific IP addresses. I am hooking into ``` admin_session_user_login_success ``` and when my function runs, I am attempting to run ``` Mage::getSingleton('admin/session')->logout(); ``` however that function does not exist ``` Invalid method Mage_Admin_Model_Session::logout ``` I read on ``` http://stackoverflow.com/questions/8455022/how-to-force-magento-to-logout ``` that the account controller or the session controller can also be used to log the user out but I am not sure how to logout an admin user. Any snippets or ideas are greatly appreciated! Thank you! Jeff