?
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
Medium Priority
?
154 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 1000 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 1000 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

Quiz: What Do These Organizations Have In Common?

Hint: Their teams ended up taking quizzes, too.

Question has a verified solution.

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

This article provides a case study on how our local youth baseball league deployed a new website, including the platform selection, implementation and benefits to the league.
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
The purpose of this video is to demonstrate how to properly insert a Vimeo Video into a WordPress site or Blog. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp…
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…
Suggested Courses

770 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