0

I'm developing a web application using Codeigniter 3 and am making use of the fab user management library, Ion Auth, developed by Ben Edwards.

Logging in and out works very well, but what I'm having an issue with is making sure that users get logged out automatically when the browser is closed.

I've experimented with using both the database driver and files driver in Codeigniter, but both appear to display the same behaviour (user is still logged in when browser is reopened).

I've also tried using the legacy 'sess_expire_on_close' setting in config.php but it didn't appear to make any difference.

I have '$config['remember_users']' set to FALSE in the Ion Auth config file.

Any pointers would be more than welcome.

Jim

Jim Pannell
  • 147
  • 6
  • This should help; http://stackoverflow.com/questions/20805792/sess-expire-on-close-not-working – Craig Aug 24 '15 at 08:48
  • try this may be solve your problem [http://stackoverflow.com/questions/13174297/how-to-destroy-session-with-browser-closing-in-codeigniter] – Keval Rathi Aug 24 '15 at 08:48
  • From CI condfig.php documentation 'sess_expiration' The number of SECONDS you want the session to last. Setting to 0 (zero) means expire when the browser is closed – mdamia Aug 24 '15 at 08:51
  • Thanks @Craig and keval-rathi. I've seen those javascript based solutions previously and dismissed them for potentially being too flaky. Is there not a better way? – Jim Pannell Aug 24 '15 at 08:57
  • @mdamia - Setting to zero simply means that it will never expire. It doesn't mean you have to do this if you want the session to expire on browser closure. Try it and you'll see what I mean. – Jim Pannell Aug 24 '15 at 08:57
  • @jim-pannell @mdamia is right `Setting to 0 (zero) means expire when the browser is closed.` [Reference](https://github.com/bcit-ci/CodeIgniter/blob/develop/application/config/config.php). – Tpojka Aug 24 '15 at 13:52
  • @Tpojka Tried that already. Didn't appear to make any difference. – Jim Pannell Aug 25 '15 at 08:03

0 Answers0