Hey,

I'm trying to figure out how I can populate a last_login-field without
turning off Auth's redirect! I have two options but I can't put them
together to work.

Option 1:
I set the AuthRedirect to false and can polpulate the field, when I do
this:

public function beforeFilter() {
    $this->Auth->autoRedirect = false;
}

public function login() {
    ...
    if($this->Auth->login($this->data)) {
        $this->User->id = $this->Auth->user("id");
        $this->User->saveField('last_login', date("Y-m-d H:i:s"));
        $this->redirect('/');
    }
}

This works fine, but I'm losing a very important functionality: When a
user is logged out because of a session timeout and loggs in again, he/
she will NOT be redirected to the page he was going to before the
session was timed out.

I can prevent this issue by setting the autoRedirect to TRUE, but THEN
i am not able to save the last_login field because the autoRedirect
redirects BEFORE I can save any data.

This should be an issue that more people have discovered yet, so I
hope somebody can help me with this.

THX in advance, and remember: Code is poetry!

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to