User Guide

Table Of Contents
402 Chapter 16: Securing Applications
<cfcatch type="any">
<cfif FindNoCase("Invalid credentials",
cfcatch.detail)>
<cfoutput>
<script>alert("User ID or Password
invalid for user:
#cflogin.name#")</script>
</cfoutput>
<cfabort>
<cfelse>
<cfoutput>
<script>alert("Unknown error for user:
#cflogin.name#
#cfcatch.detail#")</script>
</cfoutput>
<cfabort>
</cfif>
</cfcatch>
</cftry>
Catches any exceptions.
Tests to see if the error information includes
the string "invalid credentials", which indicates
that either the dn or password is invalid. If so,
displays a dialog box with an error message
indicating the problem.
Otherwise, displays a general error message.
If an error is caught, the
cfabort tag ends
processing of the request after displaying the
error description.
End of
cfcatch and cftry blocks.
<cfif auth.recordcount>
<cfloginuser name="#cflogin.name#"
password="#cflogin.password#"
roles="#valueList(auth.cn)#">
</cfif>
</cfif>
</cflogin>
If the authorization query returns a valid record,
logs in the user. Uses the
valueList function to
create a comma-separated list of the users
retrieved group memberships, and passes
them in the
cfloginuser roles attribute.
Ends the initial
isDefined("cflogin") cfif
block .
Ends the
cflogin tag body
Code Description