I need to direct first-time users to an EULA page for a client's
extranet. I thought I'd check the last_login field in order to decide
whether to redirect there or not. However, for some reason, I'm being
logged in but none of my custom code is running.
function beforeFilter()
{
parent::beforeFilter();
$this->Auth->allowedActions = array('eula', 'register',
'reset_password');
}
public function login()
{
if (!empty($this->data))
{
if ($this->Auth->login($this->data))
{
$user = $this->Auth->user();
if (empty($user['User']['last_login']))
{
$this->Auth->redirect(
array(
'controller' => 'users',
'action' => 'eula'
)
);
}
else
{
/* save the login time
*/
$user['User']['last_login'] = date('Y-m-d
H:i:s');
$this->User->save($user);
$this->Session->write('Auth.User',
$user['User']);
}
}
else
{
$this->Session->setFlash($this->Auth->authError);
}
}
}
At first, I thought that the redirect() call was bad or something.
But, if I toss in a die(debug('logged in')); right after the login()
call, that doesn't run, either.
So, how am I being logged in? I wondered if Cake's magic was getting
in the way so I did this:
public function login()
{
if (!empty($this->data))
{
die(debug('got data'));
// ...
This never fires, either. So, I then did this:
public function login()
{
die(debug('wtf'));
Guess what? This fires.
Anyone got a tip for me?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---