HI, i have created this application.cfm inside the cfm i had a function call invoke which allowed me to call my NT secuity for the authentication. Now i need your help, i had a dirtory call admin, whenever user click on any application insdie admin dirtory should go to my application.cfm first but it never happen. can anyone tell me where do i do wrong. here is my code.
------------------------------------------------------------>
<CFAPPLICATION NAME="PhoneApp">
<cfset goodlogin=false>
<cfif isDefined("form.logon"
and len(trim(form.userid)) and len(trim(form.passwd))>
<!--- Note: This is where you would replace the cfinvoke with code from one of
the other security options (Example 1, 3, or 4) --->
<!---Invoke NTSecurity CFC as if it were in the same directory as your calling CFML page.--->
<cfinvoke
component = "NTSecurity"
method = "authenticateAndGetGroups"
domain = ""
userid = "#Form.UserID#"
passwd = "#Form.Passwd#"
returnVariable = "GetUsers">
<cfscript>
auth = ToString(GetUsers); // GetUsers is either boolean false or a string which is the list of groups valid user belongs to.
if (auth is "false"
auth = "false";
else
auth = "true";
</cfscript>
<cfif isDefined("GetUsers"
and auth >
<cfif FindNoCase("PhoneAdmins", GetUsers)>
<CFSET UROLE = "Admin">
<cfelse>
<cfset UROLE="User">
</cfif>
<CFIF IsUserInRole("Admin"
or ("User"
>
<cftry>
<cflogin applicationtoken="PhoneApp" cookiedomain="">
<cfloginuser name="#form.userID#" password="#form.passwd#" roles="UROLE">
<cfcatch type="security">
<H3 ALIGN="center">Invalid Login</H3>
<cfset showLogin="yes">
</cfcatch>
</cftry>
<cfelse>
<cfset showLogin="yes">
<cfset goodlogin = true>
</CFIF>
<CFIF showLogin>
<!--- Recreate the url used to call this template --->
<CFSET url = "#cgi.script_name#">
<CFIF cgi.query_string is not "">
<CFSET url = url & "?#cgi.query_string#">
</CFIF>
<!--- Populate the login with the recreated url --->
<BODY ONLOAD="document.forms.Logon.username.focus();">
<CFOUTPUT>
<FORM ACTION="#cgi.SCRIPT_NAME#" METHOD="post" NAME="Logon">
</CFOUTPUT>
<TABLE WIDTH="400" CELLPADDING="10" ALIGN="center">
<TR>
<TD COLSPAN="2" ALIGN="center" BGCOLOR="#003399"><FONT SIZE="+1" COLOR="Silver">LOGIN SCREEN</FONT><BR><FONT COLOR="White">(NT UserID and Password)</FONT></TD>
</TR>
<TR>
<TD ALIGN="right"><B>Username:</B></FONT></TD>
<TD><INPUT TYPE="text" NAME="userid" SIZE="10"></TD>
</TR>
<TR>
<TD ALIGN="right"><B>Password:</B></FONT></TD>
<TD><INPUT TYPE="password" NAME="passwd" SIZE="20"></TD>
</TR>
<TR>
<TD COLSPAN="2" ALIGN="center"><INPUT TYPE="submit" VALUE="Logon"></TD>
</TR>
<TR>
<TD COLSPAN="2" ALIGN="center" VALIGN="bottom"><HR></TD>
</TR>
</TABLE>
</FORM>
</BODY>
<CFABORT>
</CFIF>
</cfif>
</cfif>
</cflogin>
thank you
------------------------------------------------------------>
<CFAPPLICATION NAME="PhoneApp">
<cfset goodlogin=false>
<cfif isDefined("form.logon"
<!--- Note: This is where you would replace the cfinvoke with code from one of
the other security options (Example 1, 3, or 4) --->
<!---Invoke NTSecurity CFC as if it were in the same directory as your calling CFML page.--->
<cfinvoke
component = "NTSecurity"
method = "authenticateAndGetGroups"
domain = ""
userid = "#Form.UserID#"
passwd = "#Form.Passwd#"
returnVariable = "GetUsers">
<cfscript>
auth = ToString(GetUsers); // GetUsers is either boolean false or a string which is the list of groups valid user belongs to.
if (auth is "false"
auth = "false";
else
auth = "true";
</cfscript>
<cfif isDefined("GetUsers"
<cfif FindNoCase("PhoneAdmins", GetUsers)>
<CFSET UROLE = "Admin">
<cfelse>
<cfset UROLE="User">
</cfif>
<CFIF IsUserInRole("Admin"
<cftry>
<cflogin applicationtoken="PhoneApp" cookiedomain="">
<cfloginuser name="#form.userID#" password="#form.passwd#" roles="UROLE">
<cfcatch type="security">
<H3 ALIGN="center">Invalid Login</H3>
<cfset showLogin="yes">
</cfcatch>
</cftry>
<cfelse>
<cfset showLogin="yes">
<cfset goodlogin = true>
</CFIF>
<CFIF showLogin>
<!--- Recreate the url used to call this template --->
<CFSET url = "#cgi.script_name#">
<CFIF cgi.query_string is not "">
<CFSET url = url & "?#cgi.query_string#">
</CFIF>
<!--- Populate the login with the recreated url --->
<BODY ONLOAD="document.forms.Logon.username.focus();">
<CFOUTPUT>
<FORM ACTION="#cgi.SCRIPT_NAME#" METHOD="post" NAME="Logon">
</CFOUTPUT>
<TABLE WIDTH="400" CELLPADDING="10" ALIGN="center">
<TR>
<TD COLSPAN="2" ALIGN="center" BGCOLOR="#003399"><FONT SIZE="+1" COLOR="Silver">LOGIN SCREEN</FONT><BR><FONT COLOR="White">(NT UserID and Password)</FONT></TD>
</TR>
<TR>
<TD ALIGN="right"><B>Username:</B></FONT></TD>
<TD><INPUT TYPE="text" NAME="userid" SIZE="10"></TD>
</TR>
<TR>
<TD ALIGN="right"><B>Password:</B></FONT></TD>
<TD><INPUT TYPE="password" NAME="passwd" SIZE="20"></TD>
</TR>
<TR>
<TD COLSPAN="2" ALIGN="center"><INPUT TYPE="submit" VALUE="Logon"></TD>
</TR>
<TR>
<TD COLSPAN="2" ALIGN="center" VALIGN="bottom"><HR></TD>
</TR>
</TABLE>
</FORM>
</BODY>
<CFABORT>
</CFIF>
</cfif>
</cfif>
</cflogin>
thank you