-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreateAccountLDAP.cfm
46 lines (46 loc) · 1.46 KB
/
createAccountLDAP.cfm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<cfif not Find("createAccount.cfm", PATH_INFO)>
<cflocation url="index.cfm" addtoken="no">
<cfabort>
</cfif>
<cfscript>
// LDAPFilter = '(&(mail=' & Email & ')(partialname=' & LastName & ')(partialName=' & FirstName & '))';
/* 2005-10-07 akohler
UCLA's LDAP server breaks multi-term names into "words", and puts each word in a partialName attribute.
This means that a last name like Bell-Gam gets stored as partialName=Bell and partialName=Gam, but
not as partialName=Bell-Gam.
Changed the LDAPFilter assignment to use be more flexible; now looks for:
mail=Email AND partialName=FirstName AND (sn=LastName OR partialName=LastName)
*/
LDAPFilter = '(&(mail=' & Email & ')(partialName=' & FirstName & ')(|(sn=' & LastName & ')(partialName=' & LastName & ')))';
</cfscript>
<cftry>
<cfldap action="query"
name="Person"
start="ou=Faculty and Staff,ou=person,dc=ldap,dc=ucla,dc=edu"
scope="subtree"
startrow="1"
maxrows="100"
attributes="cn,
mail,
postalCode,
telephoneNumber,
title,
uclaPostalAddress"
filter="#LDAPFilter#"
server="ldap.ucla.edu">
<cfcatch type="Any">
<cfscript>
up2snuff = 0;
error = "Unable to connect to LDAP server";
</cfscript>
</cfcatch>
</cftry>
<cfif up2snuff>
<cfif Person.RecordCount eq 0>
<cfset em="Your identity could not be verified with the UCLA employee database."/>
<cfscript>
goodCredential = 0;
//em = 'Your identity could not be verified with the UCLA employee database.';
</cfscript>
</cfif>
</cfif>