Search code examples
phpauthenticationzend-framework2zend-routezfcuser

Zend Framework 2 - ZFCUser action whitelisting does not work for rerouting


I'm using this function for whitelisting a few actions from the ZFCUser login.

Everything works great unless I redirect to one of these whitelisted pages. For example I have the myFormAction which reroutes in case of an invalid form to itself or to a successAction.

The problem is now that after clicking the button in any of these cases I end up seeing the ZFCUser login. When I go to one of these pages via URL or link there the first time, it works.

Here is my code for the two cases in myFormAction:

Failure:

return array('myVar' => $myVar);

Success:

return $this->redirect()->toRoute('myModule', array('action' => 'Success'));

Any ideas what I might be doing wrong? Is maybe the rerouting not passing the onBootstrap function and ZFCUser blocks it somewhere else?


Solution

  • Ok, that was a stupid one!

    There was an error in my link url which wasn't shown because of the ZFCUser's redirecting!

    Logging in showed the real path and revealed the error...