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!
1 Answer 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
testActionin your module's controller.Please provide your controller file for reference ?