Welcome Guest, Not a member yet? Register   Sign In
"remember me" sessions. (And "not remember me"). Can the user have a choice?
#1

[eluser]tomdelonge[/eluser]
Alright, so the session class is great. But I can't figure out how to do something. The "remember me" checkbox on login should have the cookie set to some longer period of time (hours or days or weeks, whatever). And if it's not checked, then the cookie expiration needs to be set to 0 (isn't that right?).

At any rate, in the config.php file, you can set your session configuration. How can I possibly have a choice when the user logs in? Or is this way too complicated to even accomplish?

Ideas?
#2

[eluser]WanWizard[/eluser]
You need to extend the session library to have support for sess_expiration 0 (valid till end of browser session), by default CI doesn't support this.

This allows you to check in your MY_Session constructor for the existence of a 'remember_me' cookie, and modify the value of sess_expiration before the session library creates, loads or updates the session. Your login controller should create this 'remember_me' cookie.
#3

[eluser]Stolz[/eluser]
PK Session

A MY_Session that includes a method to create a session cookie that expires when browse closes.

http://codeigniter.com/wiki/PK_Session/




Theme © iAndrew 2016 - Forum software by © MyBB