Force Logout on page close

3 posts by 2 authors in: Forums > CMS Builder
Last Post: July 9, 2010   (RSS)

By 4cdg - July 9, 2010

Customer would like to have CMS logout when they close the browser.

Is there an easy way to do this?

Thanks

4cdg

Re: [4cdg] Force Logout on page close

By Jason - July 9, 2010

Hi 4cdg,

By default, CMS Builder doesn't support this. However, there is a work around if you feel comfortable changing the code a little.

Open the file cmsAdmin/lib/init.php (make a backup of this file first)
Near the bottom of the page, you'll see this line of code:

ini_set('session.cookie_lifetime', 60*60*24 ); // cookies are removed after this many seconds of inactiity (set to 0 for session only)

Change it to this:
ini_set('session.cookie_lifetime', 0 ); // cookies are removed after this many seconds of inactiity (set to 0 for session only)

Save the file.

Next, logout of CMS Builder and clear out your cache and cookies. Try logging back into CMS Builder, then closing the browser. When you reopen the browser, you should have to re-sign in.

The only issue is that if you upgrade CMS Builder, this change will be overwritten. So it's a good idea to create a file called cmsAdmin/CUSTOM_CODE_CHANGES.txt to document any changes you made so that you can easily make them again after upgrading.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/