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
151 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Introduction In this tutorial, I'll explain how to create an animated progress meter in a wireframe prototype developed using Axure RP 7.0 - a leading prototyping tool for designing web sites and software. (For more information about Axure and gett…
What You Need to Know when Searching for a Webhost Provider
The purpose of this video is to demonstrate how to connect a WordPress website to Google Analytics. This will be demonstrated using a Windows 8 PC Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php :…
The purpose of this video is to demonstrate how to insert an Iframe into WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Open Page or Post…

717 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