Excuse me if dupe:

I am trying out the functionality of the CFLOGIN tsg snf it doesn't seem to work as 
advertised.

According to the docs "Code in thr cflogin tag only executes if there is no user is 
logged in".

The system authenticates and displays the protected page but when accessing another 
page in the same dir the same code re-executes and doesn't see the form login vars and 
boots me to the login page. 

Am I missing something? Here is part of the code in Application.cfm:

Thank you all.

<cfset AllowedRoles = "Domain Users"> 
 
<cflogin>
 <cfif isdefined("form.password") and isdefined("form.username")>
 
  <!--- WE NEED TO PROVIDE THIS SOMEHOW. SIMILAR TO NT LOGIN WOULD DO. --->
  <CFSET Request.myDomain = "STS1">
  <!--- TRY TO AUTHENTICATE USER --->
  <cfinvoke
  component = "NTSecurity"
  method = "authenticateUser"
  domain = "#Request.myDomain#"
  userid = "#form.username#"
  passwd = "#form.password#"
  returnVariable = "Auth"> 
  
  <cfif #Auth# IS "True">
  <!--- SUCCESS --->
  <cfset failed = "no"> 
  <!---NOW LET'S CHECK WHAT GROUPS(roles) I HAVE --->     
  <cfinvoke
  component = "NTSecurity"
  method = "getUserGroups"
  domain = "#Request.myDomain#"
  userid = "#form.username#"
  passwd = "#form.password#"
  returnVariable = "MyGroups"> 
        
  <cfoutput>
  <CFSET TheRoles ="#Replace('#MyGroups#',', ',',','All')#">
  </cfoutput>
  
<cfloginuser name="#form.username#"
  password="#form.password#"
  roles="#TheRoles#"
     > 
  <CFELSE>

 <!----Did not pass authentication so redirect with message--->

  <cfset message = "There was a problem with your login.">
  <cflocation 
url="../../#LOGINPATH#?url=#cgi.script_name#&#cgi.query_string#&message=#message#" 
addtoken="no">
  </CFIF>
  
   
 
 <CFELSE>
 <!---No FORM login vars so redirect to login page --->    
 <cfset message = ""> 
 <cflocation 
url="../../#LOGINPATH#?url=#cgi.script_name#&#cgi.query_string#&message=#message#" 
addtoken="no"> 
 
 
 </CFIF>
<cflogin>

______________________________________________________________________
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to