I’m having 2 login forms in my (cake) application. One on the home page (served by pages controller) and one in my user controller. The one from my user controller is working fine. But when I try to login from the homepage I get a blank page and I see in firebug I got a 404. The strange thing is that the session is setup OK.
It’s looks like it has something to do with $this->Auth->autoRedirect = false (which is set in user controller beforeFilter()). What could be the problem?
This is how my login action looks like:
function login()
{
/* Werkt nog niet vanuit `home login` */
if ($this->Auth->user())
{
if(!empty($this->data))
{
/* Update last login */
$this->User->id = $this->Auth->user('id');
$this->User->saveField('last_login', date('Y-m-d H:i:s'));
}
$this->redirect($this->Auth->redirect());
}
}
After trying everything I could think of, my last hope was not using the (default) pages controller. So what I did was copy it to my app/controllers and made it look like:
I also moved some stuff from my user_controller to my app_controller:
And now everything works fine! Maybe it had something to with the pages controller not having access to $this->Session or $this->Auth?