macromedia.coldfusion.getting_started
[Top] [All Lists]

Re: application.cfc / cflogin prevents page display

Subject: Re: application.cfc / cflogin prevents page display
From: GArlington <garlington@xxxxxxxxxxxxx>
Date: Thu, 31 Jul 2008 03:40:20 -0700 (PDT)
Newsgroups: macromedia.coldfusion.getting_started

On Jul 30, 8:38 pm, "wltiii_2" <webforumsu...@xxxxxxxxxxxxxx> wrote:
> I don't understand this problem at all. I have an application that requires a
> user to login. If the user is not already registered, they have the option to
> register. So, in the application.cfc I have code in the onRequestStart that
> checks if the registration form was called, if not, it goes through the 
> cflogin
> process. Currently, I have the db lookup dummied by always providing a "true"
> result on the db lookup. The logic does some minimal validation that a user 
> and
> password were entered. If not, everything works fine. The login screen
> re-displays with the error message. However, if I enter a user/password
> (remember, all will pass this test currently), the page I post to does not
> contain any content. Nothing. The address bar shows the correct address, but
> there is no page source. Likewise, if I follow the link from the login screen
> to the registration page, the registration page is likewise empty.
>
>  I've attached the code from my application.cfc below. Note that I am
> dynamically setting the post action with variable loginAction. You can try it
> out to get a better understanding by going 
> tohttp://www.changent.com/rr/index.htmland either clicking the Login link, or
> any of the other links below My Account (this is where the logic comes in to
> dynamically alter the post action of the login form).
>
>  Thanks for your help!
>
>  Bill
>
I do not have a server setup to test it yet, but I have a suspicion
that the reason for your problem may be missing <cfreturn />
statement...
>  <cffunction name="onRequestStart" access="public" output="false">
>            <cfargument name = "request" required="true"/>
>
>            <cfif IsDefined("Form.logout")>
>                   <cflogout>
>            </cfif>
>
>            <cfparam name="loginAction" default="#request#">
>            <cfif loginAction EQ "/rr/webapp/account_login.cfm">
>                         <cfset loginAction = "account_overview.cfm">
>            </cfif>
>
>            <cfif NOT isDefined("FORM.register")>
>                    <cflogin>
>                           <cfif NOT IsDefined("cflogin")>
>                                  <cfinclude template="account_login.cfm">
>                                  <cfabort>
>                           <cfelse>
>                                  <cfif cflogin.name IS "" OR cflogin.password 
> IS "">
>                                         <cfset errorMessage="You must enter 
> text in both the User Name and
> Password fields.">
>                                         <cfset errorCode="2">
>                                         <cfinclude 
> template="account_login.cfm">
>                                         <cfabort>
>                                  <cfelse>
Right now, the way you defined your onRequestStart you will ALWAYS end
up here...
>                                                 <cfquery 
> datasource="#application.Datasource_RR_Prod#" name="loginQuery">
>                                                         SELECT r.password
>                                                         FROM realtors r
>                                                         WHERE r.biz_email = 
> <cfqueryparam cfsqltype="cf_sql_varchar"
> value="#cflogin.name#">
>                                                 </cfquery>
>                                                 <!--- <cfif 
> loginQuery.RecordCount EQ "1" AND loginQuery.password EQ
> Hash("#cflogin.password#")> --->
>                                                 <cfif "1" EQ "1">
And then here...
>                                                    <cfloginuser 
> name="#cflogin.name#" Password = "#cflogin.password#"
> roles="User">
So, you are going to login your user as many times as he/she hits the
page...
>                                                 <cfelse>
>                                                         <cfset 
> errorMessage="Your login information is not valid. Please Try
> again.">
>                                                         <cfset errorCode="2">
>                                                    <cfinclude 
> template="account_login.cfm">
>                                                    <cfabort>
>                                         </cfif>
>                                  </cfif>
>                           </cfif>
>                    </cflogin>
>                 </cfif>
>
>         </cffunction>


<Prev in Thread] Current Thread [Next in Thread>