Problems with User Autentication

Ask a Question related to Coldfusion - Getting Started, Design and Development.

  1. #1

    Default Problems with User Autentication

    I am trying to develop a login page for my website using a table with userID
    and Password through a coldfusion interface. I used some of the code that
    dreamweaver gives you to login in a user by creating a sever behavior. This
    code allows me to input a username and password that I should be able to match
    up to the database table. This is the opposite of what it is doing, the code
    only takes my username and password and goes to the "login_failed.cfm" page.
    This is the only thing that happens even if I put in a correct username and
    password.

    I have been working on this problem for a while and I don't know that much
    about html other then getting aquainted with it for less than a month.

    If anybody could help me out with this that would be great!
    Here is the exact code that I have:

    </html>
    <cfif IsDefined("FORM.Username")>
    <cfset MM_redirectLoginSuccess="eelv/act_sub.cfm">
    <cfset MM_redirectLoginFailed="login_failed.cfm">
    <cfquery name="MM_rsUser" datasource="cfdocexamples">
    SELECT UserID,Password,Roles
    FROM LoginInfo
    WHERE UserID='#FORM.Username#'
    AND Password='#FORM.Password#'
    </cfquery>
    <cfif MM_rsUser.RecordCount NEQ 0>
    <cftry>
    <cflock scope="Session" timeout="30" type="Exclusive">
    <cfset Session.MM_Username=MM_rsUser.UserID>
    <cfset Session.MM_UserAuthorization=MM_rsUser.Roles[1]>
    </cflock>
    <cfif IsDefined("URL.accessdenied") AND true>
    <cfset MM_redirectLoginSuccess=URL.accessdenied>
    </cfif>
    <cflocation url="#MM_redirectLoginSuccess#" addtoken="no">
    <cfcatch type="Lock">
    <!--- code for handling timeout of cflock --->
    </cfcatch>
    </cftry>
    </cfif>
    <cflocation url="#MM_redirectLoginFailed#" addtoken="no">
    <cfelse>
    <cfset MM_LoginAction=CGI.SCRIPT_NAME>
    <cfif CGI.QUERY_STRING NEQ "">
    <cfset MM_LoginAction=MM_LoginAction & "?" & XMLFormat(CGI.QUERY_STRING)>
    </cfif>
    </cfif>

    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    <link href="css/bluestyles.css" rel="stylesheet" type="text/css" />
    <style type="text/css">

    .style2 { font-size: 16px;
    font-weight: bold;
    color: #FFFFFF;
    }
    </style>
    </head>
    <body>
    <div id="Header"> </div>
    <div id="Image"> </div>
    <!-- Editable Region -->
    <div id="Content">
    <p class="style2">LOG IN </p>
    <p align="left" class="style2">Please log into the WEARS System </p>
    <div align="right"><cfoutput>#DateFormat(Now(), "mmmm d,
    yyyy")#</cfoutput></div>
    <div align="right"><cfoutput>#TimeFormat(Now(), "long")#</cfoutput></div>
    <p align="left" class="style2">&nbsp;</p>
    <p align="left" class="style2">&nbsp;</p>
    <p align="left" class="style2">
    <form ACTION="<cfoutput>#MM_loginAction#</cfoutput>" name="FORM"
    method="POST">
    <table>
    <tr>
    <td valign="top"><span class="style2"> Username: </span></td>
    <td><input size="50" maxlength=250 type="text"
    name="Username">
    </td>
    </tr>
    <tr>
    <td valign="top"><strong> Password: </strong></td>
    <td><input size="50" maxlength=250 type="text"
    name="Password">
    </td>
    </tr>
    </table>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <div align="center">
    <input type="submit" name="Submit" value="Log In">
    </div>
    </form>
    </div>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    </body>
    </html>

    Thanks for your time!!
    Jeff



    jedale Guest

  2. Similar Questions and Discussions

    1. Login and New User Problems
      I'm using php for my website and I add in the insert record and then check new user to a page. Then when I go check the page in my web browser it...
    2. User Authentication problems
      hi everyone i am using a php site and i have been trying to implement user authentication by completing the macromedia tutorial "Macromedia -...
    3. Windows autentication with WindowsPrinicipal
      Hello, I'm using Windows Authenetication with my code below with Windows Principal. I noticed that when i use IsinRole with "BUILT\Administrator...
    4. Windows autentication PROBLEMS
      HI I was using Windows Authentication before in my LOCALHOST with BuiltIN/Administrator(And i was getting DOMAIN\USERNAME and it was working now ...
    5. Forms autentication and registration page - some advices
      Hi, I implement forms authentication in my application. So I have a login form. Actually I have two custom Web controls, one to login and one to...
  3. #2

    Default Re: Problems with User Autentication

    Even though you have MM_redirectLoginSuccess set to act_sub.cfm, there is a
    posssibility that this is being changed where you are checking for
    url.accessdenied and assigning its value to MM_redirectLoginSuccess. So double
    check ur url variables when posting.

    Also your failure redirection is out of context. If you notice, you have
    closed the cfif before the failure cflocation. So it should be



    <cfif IsDefined("FORM.Username")>
    <cfset MM_redirectLoginSuccess="eelv/act_sub.cfm">
    <cfset MM_redirectLoginFailed="login_failed.cfm">
    <cfquery name="MM_rsUser" datasource="cfdocexamples">
    SELECT UserID,Password,Roles
    FROM LoginInfo
    WHERE UserID='#FORM.Username#'
    AND Password='#FORM.Password#'
    </cfquery>
    <cfif MM_rsUser.RecordCount NEQ 0>
    <cftry>
    <cflock scope="Session" timeout="30" type="Exclusive">
    <cfset Session.MM_Username=MM_rsUser.UserID>
    <cfset Session.MM_UserAuthorization=MM_rsUser.Roles[1]>
    </cflock>
    <cfif IsDefined("URL.accessdenied") AND true>
    <cfset MM_redirectLoginSuccess=URL.accessdenied>
    </cfif>
    <cflocation url="#MM_redirectLoginSuccess#" addtoken="no">
    <cfcatch type="Lock">
    <!--- code for handling timeout of cflock --->
    </cfcatch>
    </cftry>
    <cfelse>
    <cflocation url="#MM_redirectLoginFailed#" addtoken="no">
    </cfif>
    <cfelse>
    <cfset MM_LoginAction=CGI.SCRIPT_NAME>
    <cfif CGI.QUERY_STRING NEQ "">
    <cfset MM_LoginAction=MM_LoginAction & "?" & XMLFormat(CGI.QUERY_STRING)>
    </cfif>
    </cfif>

    CFDEBUG Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139