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!

asked Jul 8, 2014 at 16:19
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

answered Nov 7, 2014 at 23:21

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.