I am having a problem with Logging in and Session variables. I am new to
ColdFusion, but program in other languages including PHP and Java. Recently I
got a new job and had to learn ColdFusion, I really like many of the things it
can do with ease, but I'm stumped on a problem the previous programmer did not
fix before he left.
We use MX 6.1, Apache authentication and a query to get user roles in a
modified Mach II framework. The problem is when we update frequently in
develpment we get CFUSERNAME is undefined in SESSION. I'm honestly not
completely sure why this is happening, but if we increment the applicationtoken
by one it works again for awhile.
Below is the login code we are using:
<!--- login handling code --->
<cflogin applicationtoken="dgf_dev_196">
<!--- cflogin should be available once you are apache authenticated --->
<cfif IsDefined("cflogin")>
<!--- get roles for login name --->
<cfstoredproc
procedure="INTRA.WEB_INTRA_CONFIG.getRoles"
datasource="intra_dev">
<cfprocparam dbvarname="username"
cfsqltype="cf_sql_varchar" value="#cflogin.name#">
<cfprocresult name="temproles">
</cfstoredproc>
<cfset request.roles=ValueList(temproles.roles)>
<cfif request.roles neq 0>
<!--- set cfusion login setup --->
<cfloginuser
name="#cflogin.name#"
password="#cflogin.password#"
roles="#request.roles#">
<cfset session.cfpassword="#cflogin.password#">
<cfset session.cfusername="#cflogin.name#">
</cfif>
<!--- this should never happen if Apache .htaccess security is working
--->
<cfelse>
<cfinclude
template="/CF-INF/cftemplates/dev/Security/notAuthorized_view.cfm">
</cfif>
</cflogin>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application
http://www.houseoffusion.com/banners/view.cfm?bannerid=48
Message: http://www.houseoffusion.com/lists.cfm/link=i:15:1085
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/15
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:15
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54