Hey Frank,

I see two possible problems. Not sure if this was just a copy mistake, but
your <cflogin> is not closed properly in the included code. Rule that out
first. Second, I'm not sure but cflocation could be causing some problems.
If the user doesn't pass the authentication process, I use <cfinclude> for
the login form and then use <cfabort> to make sure all processing stops.
 

-----Original Message-----
From: Frank Mamone [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, July 23, 2002 12:48 PM
To: CF-Talk
Subject: CFLOGIN Problems


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=#mes
sage#" 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=#mes
sage#" addtoken="no"> 
 
 
 </CFIF>
<cflogin>
______________________________________________________________________
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to