1
我使用LDAP對我的應用程序中的用戶進行身份驗證。使用LDAP時捕獲錯誤密碼
<cftry>
<cfldap action="query"
name ="qryAuth"
attributes="cn,displayname,mail"
start ="DC=corp,DC=com"
server ="#LDAPserver#"
filter = "(cn=#arguments.EID#)"
username ="corp\#arguments.EID#"
password ="#arguments.password#">
<cfset this.addlog(arguments.EID, "Success on #LDAPserver#")>
<cfreturn true>
<cfcatch>
<cfset this.addlog(arguments.EID, "#cfcatch.message# on #LDAPserver#")>
<cfif cfcatch.message CONTAINS "error code 49">
錯誤代碼49是用戶輸入錯誤的密碼時。每次運行時都會記錄一個錯誤。有沒有辦法通過LDAP檢查密碼而不使用try/catch?
我剛剛檢查了我們做的方式,我們使用try/catch。 –
我總是使用try/catch。有沒有你不想這樣做的理由?你總是可以檢查不同的錯誤來執行不同的邏輯(就像你在做的那樣)。 –
我不喜歡每個catch語句都記錄在CF管理員中。 –