views:

260

answers:

1

I'm trying to make the Auth module to 'remember' the user session with a checkbox on the login page. What happens is that no cookie is created, only session as usually. I've noticed the user_tokens table, but don't see any use of user_token model's methods at all. I do pass (bool) TRUE as a third parameter to login() method, but there's no difference.

Is this feature complete at all or I have to add my own by overwritting the login() method of Model_Auth_User ?

What's the best practice for this ?

+1  A: 

Answer from the Kohana forum (credit to biakavero) pasted here for reference:

  1. Call Auth::instance()->login() with $remember = TRUE
  2. DB Token for current user created. Cookie authautologin generated.
  3. Destroy user object : Session::instance()->delete('auth_user'); // dont call logout() method as it will delete cookie & token
  4. Call Auth::instance()->auto_login() and check for Auth::instance()->get_user() // should return Model_User object
Brian Riehman
any idea why this wouldn't work on a page that is $_POSTed to with flash (swfupload)?
handsomeGun