Kemo
Kemo

Reputation: 7042

Remember the session with Auth module?

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 ?

Upvotes: 2

Views: 1344

Answers (1)

Brian Riehman
Brian Riehman

Reputation: 28526

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

Upvotes: 3

Related Questions