Showing results for 
Search instead for 
Did you mean: 

Password Protect front end

Password Protect front end

I'm wondering if anyone is aware of a method to password protect a magento store. 


We require users to login before they have access to our site. At the moment we are using htpasswd, however this is causing issues some users, and is not a method we can continue to use.


I've searched for addons, but there doesn't seem to be anything out there.


Re: Password Protect front end

Hi @CaptainG,


I've checked the Marketplace and I've found, in theory, a solution:


If not is a simple customization. You can observe the predispatch event and redirect to login if customer is guest.


Let's say you have a module called Vendor_Wholesalers. Your config.xml file will have something like:


<?xml version="1.0"?>

Then, the observer will use something like:


class Vendor_Wholesalers_Model_Observer {

    public function redirectPage($event)
        $action = $event->getEvent();
        $requestString  = $action->getControllerAction()->getRequest()->getRequestString();
        if (!$this->_getSession()->isLoggedIn()) {
            if ($requestString !== '/customer/account/login/' && $requestString !== '/customer/account/loginPost/'  && $requestString !== '/customer/account/logout/') {
                header('Location:' . Mage::getUrl('customer/account/login/'));

    private function _getSession()
{ return Mage::getSingleton('customer/session'); } }

I know isn't perfect and isn't the whole example but it could be something similar.