Code
<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>
<cfif auth.recordcount>
<cfloginuser name="#cflogin.name#"
password="#cflogin.password#"
roles="#valueList(auth.cn)#">
</cfif>
</cfif>
</cflogin>
Description
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
processing of the request after displaying the
error description.
If the second query returned a valid record,
logs in the user and sets the roles to the values
returned by the query.
Ends the if initial isDefined("cflogin") block .
Ends the
tag body.
cflogin
Implementing user security
tag ends
cfabort
369
Need help?
Do you have a question about the COLDFUSION MX 61-DEVELOPING COLDFUSION MX and is the answer not in the manual?
Questions and answers