CFLOGIN works, but not simultaneously on different servers/broswers
I'm using CFLOGIN with application.cfc which works great when I test it - I'll call it login session A in browser window 1.
When I simultaneously log into the same app on a different server with a different username (login session B in browser window 2), I can't login - unless I log out out of session A/browser window 1 first. Something in my new code is preventing me from logging into my app more than one time, even when the apps are on separate servers and I'm using different usernames.
We have the same app on various servers (test/development/production), and I used to be able to login on 2-3 browsers or servers at a time - and I never had a problem until recently when I made some changes to the application.cfc and login code.
I updated the code because before the session scopes and login credentials were not being initiated and terminated together (upon login/logout). Before, a user was clicking 'logout' and it was clearing the session scopes without invoking CFLOGOUT. Now, I fixed that, but I have another problem, which is that I can't log into the application on two different browsers or servers at the same time (even if I'm using different login usernames). Any suggestions would be appreciated.
---------------------------------------------
<cfcomponent displayname="Application" output="false">
<cfset this.name = 'SampleApp'>
<cfset this.SessionManagement = true>
<cfset this.SetClientCookies = true>
<cfset this.SessionTimeout = CreateTimeSpan( 0, 0, 5, 0 ) />
<cffunction name="onSessionStart" access="public" returntype="void" output="false">
<cfset session.hostname = 'http://'&#CGI.HTTP_HOST#&'/'>
<cfset session.dbase = 'localdb'>
<cfset session.roles = ArrayNew(1)>
<cfreturn>
</cffunction>
<cffunction name="onApplicationStart" access="public" returntype="boolean" output="false">
<cflog file="SampleApp" type="information" text="Application started." />
<cfreturn true>
</cffunction>
<cffunction name="onApplicationEnd" returntype="void" output="false" hint="Executes on session timeout or if server shuts down.">
<cfcookie name="CFID" value="#CFID#" expires="now">
<cfcookie name="CFTOKEN" value="#CFTOKEN#" expires="now">
<cfreturn>
</cffunction>
<cffunction name="onRequestStart" access="public" returntype="void" output="true" hint="Executes before each page processes.">
<cfargument name="targetPage" type="String" required="true"/>
<cfsilent>
<cfif GetAuthUser() NEQ ''>
<cfif NOT isDefined('session.uname')>
<cfif CGI.HTTP_REFERER DOES NOT CONTAIN "login.cfm">
<cfinclude template="expired.cfm">
<cfabort>
</cfif>
</cfif>
</cfif>
<cflogin>
<!--- Flash Remoting setCredentials() passes cflogin.user and cflogin.password using checklogin.cfc --->
<cfif IsDefined('cflogin')>
<cfquery name="qValidateLogin" datasource="#session.dbase#" username="#cflogin.name#" password="#cflogin.password#">
SELECT role
FROM session_roles
</cfquery>
<cfif qValidateLogin.RecordCount GT 0>
<cfloginuser name="#cflogin.name#" password="#cflogin.password#" roles="#qValidateLogin.ROLE#">
<cflog text="User - #cflogin.name#" type="Information" file="Filename" date="yes" time="yes">
<cfelse>
<cfinclude template="login.cfm">
<cfabort>
</cfif>
<cfelse>
<cfif right(arguments.targetPage,10) is "logout.cfm">
<cflocation url="index.cfm">
<cfabort>
<cfelse>
<cfinclude template="login.cfm">
<cfabort>
</cfif>
</cfif>
</cflogin>
</cfsilent>
</cffunction>
</cfcomponent>
