Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 110690

Re: Password Protect all .cfm files in a directory?

$
0
0

Hello

What is happening now is regardless if the username and password are correct, it sends to user back the the login page (there is no application.cfm file in the top directory, nor would this matter because the login form is an html file).)

 

This is how I set up the application.cfm:

 

<cfapplication name="xxxx"

    clientmanagement="Yes"

    loginStorage="session"

    sessionmanagement="Yes"

    sessiontimeout="#CreateTimeSpan(0,0,20,0)#"

    SetClientCookies="Yes">

   

<cfparam name="Request.BaseDSN" default="xxxx">

 

<cflogin>

 

<cfif getAuthUser() is "" and NOT isDefined("form.subscriber_email")>

   

<!--- User unauthenticated and not coming from login.html --->

   

<!--- send user back to an html login page in the top directory with no application.cfm file --->

 

<cfinclude template="../login.html">

<cfabort>

       

<!---  User authenticated   --->

 

    <cfelseif isDefined("form.subscriber_email")>

 

    <CFQUERY name="auth_admin" datasource="#Request.BaseDSN#">

 

            SELECT     subscriber_ID, subscriber_fname, subscriber_email, subscriber_password

 

            FROM     main

 

            WHERE     subscriber_email = <cfqueryparam value='#Trim(form.subscriber_email)#' CFSQLTYPE='CF_SQL_VARCHAR'>

 

            AND        subscriber_password = <cfqueryparam value='#Trim(form.subscriber_password)#' CFSQLTYPE='CF_SQL_VARCHAR'>

 

    </CFQUERY>

 

<cfif auth_admin.recordcount gt 0>

 

<cfloginuser name = "#auth_admin.subscriber_email#" password = "#auth_admin.subscriber_password#" roles = "admin,poweruser">

       

<!--- Authenticated User can now browse .cfm files in this subdirectory  --->   

       

<cfinclude template="index.cfm">

<cfelse>

<!--- ???? did we do this already ??? --->   

<cfinclude template="../login.html">

<cfabort>

</cfif>      

</cfif>

</cflogin>

 

<cfcontent type="text/html; charset=utf-8">

<cfscript>

SetEncoding("form","utf-8");

SetEncoding("url","utf-8");

</cfscript>


Viewing all articles
Browse latest Browse all 110690

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>