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
148 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

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…
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…
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…

777 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