Change session expiration after initialisation? |
[eluser]AdamP[/eluser]
I have a problem with my authentification library. My work is based on this tutorial: http://www.bramme.net/2008/07/auth-libra...-tutorial/ Everything works fine, but I would like to implement a "keep me logged in" function. That means that a session should not expire automaticaly after n minutes, but be alive for unlimited time (or set it to 1+ years). This thread didn't help either: http://ellislab.com/forums/viewthread/114113/ Because at the time that a user logs in, the session is already set. The website is multilingual and the selected language is saved in a session. This is implemented with a pre_controller hook that set's the default language as soon as the website is loaded for the first time. Is there a way to change the session exipration value? Any help and solutions are welcome. Adam
[eluser]Jondolar[/eluser]
You may want to use a separate cookie instead of a session cookie. You can then set the expiration of the cookie after you authenticate. If you use the session class, you need to configure a session timeout globally. You could set this to the maximum and then use data from the session to determine if the account should time out earlier (kind of backwards).
[eluser]AdamP[/eluser]
[quote author="Jondolar" date="1250645523"]You may want to use a separate cookie instead of a session cookie. You can then set the expiration of the cookie after you authenticate. If you use the session class, you need to configure a session timeout globally. You could set this to the maximum and then use data from the session to determine if the account should time out earlier (kind of backwards).[/quote] I will take a look at this approach, thank you. So with a second cookie, I would store if the user wants a permanent login. And this cookie would also be valid after brower restart. Makes sense |
Welcome Guest, Not a member yet? Register Sign In |