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

application.cfc / cflogin prevents page display

Subject: application.cfc / cflogin prevents page display
From: "wltiii_2" <webforumsuser@xxxxxxxxxxxxxx>
Date: Wed, 30 Jul 2008 19:38:32 +0000 (UTC)
Newsgroups: macromedia.coldfusion.getting_started

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 to 
http://www.changent.com/rr/index.html and 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

 <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>
                                                <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">
                                                   <cfloginuser 
name="#cflogin.name#" Password = "#cflogin.password#" 
roles="User">
                                                <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>