I have been away for a few years and am just getting back to work, so please
forgive the rookie question.
I need to have a user automatically logged out 30 seconds after leaving my
domain. I am not using standard login due to security restraints, but setting
up application, client, and session variables. The 30 seconds just ensures
enough time for the next page to load and, if it's in my domain, the user
should not be logged out. All of the necessary code to clear client variables
and uptade database tables is in application.cfc in the onSessionEnd function.
I tried using the old
<cfapplication sessionmanagement="yes" name="MCCLL"
sessiontimeout="#createTimeSpan(0,0,0,30)#">
from a cfc via
<cfajaxproxy cfc="cfc/onPageChange" jsclassname="onPageChange">
but the <cfapplication> tag seems to have no effect. I changed the value of a
couple of session variables from within the cfc and that works, with no errors,
so I know the cfc is executing.
I know dropping the session on an onBeforeUnload JS event would be easier, but
I'm trying to drop the session and log out the user only if they go to another
domain. I don't want to use the JS
if (event.clientY < 0) logout()
as that logs out on refresh and back.
Here's what I have:
index.cfm:
<cfajaxproxy cfc="cfc/onPageChange" jsclassname="onPageChange">
<script language="javascript">
var changedPage = function(){
uid = "<cfoutput>#client.userid#</cfoutput>";
fname =
"<cfoutput>#client.firstname#</cfoutput>";
pc = new onPageChange();
//pc.setCallbackHandler(pc_result);
//pc.setErrorHandler(pc_error);
pc.resetSession(uid,fname);
}
window.onbeforeunload=changedPage;
</script>
onPageChange.cfc:
<cffunction name="resetSession" access="remote">
<cfargument name="uid" required="yes">
<cfargument name="fname" required="yes">
<cfif isdefined("session.test")>
<cfset session.test=session.test +1>
<cfelse>
<cfset session.test = 1>
</cfif>
<cfapplication sessionmanagement="yes" name="MCCLL"
sessiontimeout="#createTimeSpan(0,0,0,10)#">
</cffunction>
</cfcomponent>
I would really appreciate any suggestions.
Thanks,
CFGunny
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know
on the House of Fusion mailing lists
Archive:
http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:4612
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15