CFLDAP Error Handling
I'm trying to make a login application that checks against AD using LDAP. I've been able to query LDAP using entered information in forms. As of now, it will forward users to a desired page once correct login information is entered into the form. The problem I'm having is that when users enter incorrect information, instead of forcing them to a desired URL, it's showing a CF error page stating "
Authentication failed:[LDAP: error code 49 - 80090308: LdapErr: DSID-0C090334, comment: AcceptSecurityContext error, data 52e, vece ] |
So of course I don't want to show that. Here's the code I'm using in the form handler page.
<cfldap action="query"
server="10.0.0.0"
name="Results"
start="DC=domain,DC=org"
filter="(&(objectclass=user)(SamAccountName=#form.username#))"
username="domainname\#form.username#"
password="#form.password#"
attributes = "cn,o,l,st,sn,c,mail,telephonenumber, givenname,homephone, streetaddress, postalcode, SamAccountname, physicalDeliveryOfficeName, department">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>
<body><cfif Results.RecordCount GT 0>
<cflocation url="http://www.yahoo.com">
<cfelseif Results.RecordCount EQ 0>
<cflocation url="http://www.espn.com">
</cfif>
</body>
</html>
Any ideas or what I may be doing wrong? This is my first attempt at using CF and LDAP together. I wasn't able to get the Login Wizard to work either.
