Perhaps I should have typed if that would not work for someones "needs" We
have ran into a few times where it just was not right for the job at hand
and actually have since just always used our objects that wrap the CFLDAP
calls.
On 10/8/07, Tom Hines <[EMAIL PROTECTED]> wrote:
>
> >If for some reason that would not work then could always just use CFLDAP
> >
> >
> >>Ok, thanks. I googled that command and found this example. This one uses
> a cgi script so I guess I can just rewrite it to use coldfusion scripts.
> ..
> Example
> The following example uses the auth and status fields to determine whether
> the user is authenticated and the failure cause. It consists of three files
> that you put in the same directory:
>
> A main cfntauthexample.cfm page that displays the name if the user is
> authenticated and contains a logout link.
> A login form page that is displayed if the user is not logged in.
> The Application.cfm page, which contains all the login, authentication,
> and logout processing code.
> For a full description of login processing, see ColdFusion MX Developer's
> Guide. For information on how this example works, see the comments in the
> code.
>
> Save the following page as cfntauthenticateexample.cfm. To run the
> example, request this page in your browser or IDE.
>
> <!--- The Application.cfm page, which is processed each time a user
> requests this page, ensures that you log in first. --->
> <cfoutput>
> <h3>Welcome #GetAuthUser()#</h3>
> <!--- A link to log out the user. --->
> <a href="#CGI.script_name#?logout=Yes">Log Out</a>
> </cfoutput>
> Save the following page as loginform.cfm:
>
> <!--- A simple login form that posts back to the page whose request
> initiated
> the login. --->
> <H2>Please Log In</H2>
> <cfform action="#CGI.script_name#">
> <!--- j_username and j_password are special names that populate cflogin
> tag
> variables. --->
> User Name: <cfinput type="text" name="j_username" value="cfqa_user1"
> required="Yes"><br>
> Password: <cfinput type="password" name="j_password" value="cfqa_user1"
> required="Yes"><br>
> Domain: <cfinput type="text" name="domain" value="rnd"
> required="Yes"><br>
> <input type="submit" value="Log In">
> </cfform>
> Save the following page as Application.cfm:
>
> <!--- If this page is executing in response to the user clicking a logout
> link,
> log out the user. The cflogin tag code will then run. --->
> <cfif IsDefined("URL.logout") AND URL.logout>
> <cflogout>
> </cfif>
>
> <!--- The cflogin body code runs only if a user is not logged in. --->
> <cflogin>
> <!--- cflogin variable exists only if login credentials are available.
> --->
> <cfif NOT IsDefined("cflogin")>
> <!--- Show a login form that posts back to the page whose request
> initiated the login, and do not process the rest of this page. --->
> <cfinclude template="loginform.cfm">
> <cfabort>
> <cfelse>
> <!--- Trim any leading or trailing spaces from the username and
> password
> submitted by the form. --->
> <cfset theusername=trim(form.j_username)>
> <cfset thepassword=trim(form.j_password)>
> <cfset thedomain=trim(form.domain)>
> <cfntauthenticate username="#theusername#" password="#thepassword#"
> domain="#thedomain#" result="authresult" listgroups="yes">
> <!--- authresult.auth is True if the user is authenticated. --->
> <cfif authresult.auth>
> <!--- Log user in to ColdFusion and set roles to the user's
> Groups. --->
> <cfloginuser name="#theusername#" password="#thepassword#"
> roles="#authresult.groups#">
> <cfelse>
> <!--- The user was not authenticated.
> Display an error message and the login form. --->
> <cfoutput>
> <cfif authresult.status IS "AuthenticationFailure">
> <!--- The user is valid, but not the password. --->
> <H2>The password for #theusername# is not correct<br>
> Please Try again</H2>
> <cfelse>
> <!--- There is one other status value, invalid user name.
> --->
> <H2>The user name #theusername# is not valid<br>
> Please Try again</H2>
> </cfif>
> </cfoutput>
> <cfinclude template="loginform.cfm">
> <cfabort>
> </cfif>
> </cfif>
> </cflogin>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Get the answers you are looking for on the ColdFusion Labs
Forum direct from active programmers and developers.
http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid-72&catid=648
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:290551
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4