1 Reply Latest reply on Aug 18, 2009 10:39 AM by wam4

    cflogin returning to login page

    wam4 Level 1

      I've looked through the code provided on these forums and even copied examples over but my cflogin tag still returns the user back to the login page. When I test cflogin not in the application.cfc file (with the cflogin on a page by itself) it seems to work fine.  Can someone provide a second pair of eyes to see where I'm missing something.   In the URL it is getting the CFID and CFTOKEN -here's the returned URL after logging in "



      This is the application.cfc file:

      <cfset This.name = "myapp">
      <cfset This.Sessionmanagement="true">
      <cfset This.Sessiontimeout="#createtimespan(0,0,30,0)#">
      <cfset This.applicationtimeout="#createtimespan(1,0,0,0)#">



      <cffunction name="onRequestStart">
         <cfargument name = "request" required="true"/>
          <cfif IsDefined("Form.logout")>

              <cfif NOT IsDefined("cflogin")>
                  <cfinclude template="login.cfm">
          it's here

                      <cfquery name="loginQuery" dataSource="#mysource#">
                      select id,passwd, manager_level from personal
            where emplid = '#cflogin.name#'
                         AND passwd = '#cflogin.password#'
             and manager_level <> '8'
                       <cfif loginQuery.manager_level NEQ "">
                          <cfloginuser name="#cflogin.name#" Password = "#cflogin.password#"

      <cflocation url="home.cfm">
                                 <H2>Your login information is not valid.<br>
                              Please Try again</H2>
                          <cfinclude template="login.cfm">





      And my login form =

      <form method="post" action="home.cfm">

      ID: <input type="text" name="j_username" size="3" max="11">

      password: <input type="text" name="j_password" size="8" max="11">

      <input type="submit" name="action" value="Proceed">

        • 1. Re: cflogin returning to login page
          wam4 Level 1

          I've semi fixed the problem. It now lets the user get to the home page but it doesn't appear to be setting the <cfloginuser> variables such as name, password and rolls.


          Under the <cflogin> tag I changed the <cfif Not IsDefined("cflogin")>  to <cfif NOT IsDefined("form.j_username")>


          The example in the documents use the <cfif Not IsDefined("cflogin")> approach but it didn't work for me.

          How do you get the variables from cfloginuser or make sure they are set? When using #GetAuthUser()# I do get the j_username but #cflogin.name# or #GetUserRoles()# gives me an error - Variable GetUserRolls is undefined.

          Thanks for the help