<cfscript>
//<!--- setting basic LDAP server attributes --->
start="DC=county,DC=*****,DC=net";
servername = "server.blah.net";
port = "389"; attributes="cn,password,uid,dn,givenName,sn,edupersonaffiliation,title,physicalDeliveryOfficeName,homePhone,displayName,department,mail,employeeid";
//<!--- passing the username and password that captured from the form --->
//<!--- this filter will look in the objectclass for the user's ID --->
filter="(&(objectclass=user)(SamAccountName=#fname#))";
</cfscript>
<!--- pass the user's DN and password to see if the user authenticates --->
<cftry>
<cfldap action="QUERY"
name="results2"
attributes="#attributes#"
start="#start#"
scope="SUBTREE"
filter="#filter#"
server="#servername#"
port="#port#"
username="#fName#@***.net"
password="#fPass#">
<cfcatch type="any">
<!--- Try another domain --->
<cfscript>
start="OU=Users,OU=Department,DC=childsupport,DC=county,DC=****,DC=net";
servername = "server.blah.net";
port = "389";
//<!--- Attributes must include uid and dn. These are used within the 2 authorization queries. --->
attributes="cn,password,uid,dn,givenName,sn,edupersonaffiliation,title,physicalDeliveryOfficeName,homePhone,displayName,department,mail,employeeid";
//<!--- passing the username and password that captured from the form --->
//<!--- this filter will look in the objectclass for the user's ID --->
filter="(&(objectclass=user)(SamAccountName=#fname#))";
</cfscript>
<!--- pass the user's DN and password to see if the user authenticates --->
<cftry>
<cfldap action="QUERY"
name="results2"
attributes="#attributes#"
start="#start#"
scope="SUBTREE"
filter="#filter#"
server="#servername#"
port="#port#"
username="#fName#@****net"
password="#fPass#">
<cfcatch type="any">
<cfcookie name="UserAuth" value=false>
<cfset myResult=false>
<cfif urlLoc NEQ "flash">
<cfif find("?",#HTTP_REFERER#) EQ 0>
<cfoutput> <cflocation url="#HTTP_REFERER#?result=#myResult#" addtoken="no"></cfoutput>
<cfelse>
<cfset newLen = len(#HTTP_REFERER#) - 13>
<cfset newURL = LEFT(#HTTP_REFERER#,#newLen#)>
<cfoutput>
#newURL#
<cflocation url="#newURL#?result=#myResult#" addtoken="no">
</cfoutput>
</cfif>
</cfif>
</cfcatch>
</cftry>
</cfcatch>
</cftry>
<!--- ----------------------------------------- --->
<!--- If the userID and password are valid --->
<cfif #results2.recordcount#>
<cfset myResult=true>
<cfif urlLoc NEQ "flash">
<!---Find the user in the adminUsers table--->
<cfoutput>
<cfquery name="getUsers" datasource="#application.passdsn#">
Select * from pass_admin_users where user_name = '#fName#'
</cfquery>
|