0

I am overriding the forgotPasswordPostAction function in Mage_Customer_AccountController. This works well, I can call the function with a URL like that:

http://domain.com/whatever/index.php/customer/account/forgotpasswordpost/

Now I added a testAction function to the same controller, but I cant call it by URL, I always get forwarded to the login page (http://domain.com/whatever/index.php/customer/account/login/). Why? Can I define exceptions from that behaviour?

Thanks!

2
  • you added testAction in your module's controller.Please provide your controller file for reference ? Commented Jul 8, 2014 at 16:26
  • share your code which you tried Commented Jul 8, 2014 at 17:41

1 Answer 1

1

It has to do with the preDispatch method in the AccountController.

public function preDispatch()
{
    [...]    
    $action = $this->getRequest()->getActionName();
    $openActions = array(
        'create',
        'login',
        'logoutsuccess',
        'forgotpassword',
        'forgotpasswordpost',
        'resetpassword',
        'resetpasswordpost',
        'confirm',
        'confirmation'
    );
    $pattern = '/^(' . implode('|', $openActions) . ')/i';

    if (!preg_match($pattern, $action)) {
        if (!$this->_getSession()->authenticate($this)) {
        $this->setFlag('', 'no-dispatch', true);
        }
    } else {
        $this->_getSession()->setNoReferer(true);
    }
}

If you add your test method to the $openActions array it will be allowed. Now it gets redirected to login as stated in the if-else

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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