Solved

Does anyone know how to create a login validation in ColdFusion that will recognize that a user has closed a given tab that contained the app and make them log back in?

Posted on 2009-04-07
5
149 Views
Last Modified: 2014-10-18
I am trying to find a ColdFusion Tag or code that would be able to handle the logging in of a given user.  I have an application that I allow the user to login and logout without any problems. But when they login and just close the tab that contains the application and then go back and open a new tab and go to the same secure site they are already logged in. I was just trying to fix this where the user will be required to log back in.

Anyone have any ideas?

0
Comment
Question by:wesmarmd
5 Comments
 
LVL 39

Accepted Solution

by:
gdemaria earned 250 total points
ID: 24096550
Try adding a session cookie.  Session cookies expire when the window is closed.  
<cfcookie name="isLoggedIn" value="true">  --- no expire date

Then test to see if the cookie still exists when you return

 <cfif NOT isDefined("cookie.isLoggedIn")>
    <h1>YOU ARE LOGGED OUT</h1>
 </cfif>


You cannot terminate a session when someone leaves your site, however, you could detect when they go to your site from another site.  That is, when they return to your site.  Check the cgi.referrer variable to see if they are coming from somewhere else..
0
 
LVL 1

Assisted Solution

by:vonRogue
vonRogue earned 250 total points
ID: 24100150
If you're talking about a user having multiple tabs open in a browser like Firefox, there's no way to tie your session to just one of the tabs. As long as they keep the browser open with at least one tab open, they will be able to access your site without logging in again (as long as they do it before the server's session time expires).

Now if you're talking about how the user stays logged in even after closing down the browser completely, you will need to enable J2EE Session Management in the CF Administrator's Memory Variables Page. By default, it's set to Coldfusion Session Management, but that has the nasty side effect of keeping the session in place even after the user closes the browser.
0
 

Author Comment

by:wesmarmd
ID: 24100291
I was trying to solve the problem of a user closing an individual tab and not the whole browser. I am aware of the J2EE session setting in the administrator. I sure wish there was a away to detect whether the tab had been closed. I sure would think that in the future other people are going to want to know if the tab had been closed out.

Thanks for your insight.
0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
WEB Farm 6 74
DNS @ Naked Domain Record 5 103
Soundcloud.com 4 45
ajaxSubmit is giving me an error 1 47
One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
The purpose of this video is to demonstrate how to update a WordPress Site’s version. WordPress releases new versions of its software frequently and it is important to update frequently in order to keep your site secure, and to get new WordPress…
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question