Ask a Question related to Macromedia ColdFusion, Design and Development.
-
nckgb #1
cflogin confusion
Hi I need some help. Ifind lots of tutorials for simple login and for using
cflogin in the Application...BUT nothing about using cf_login for single pages.
Here are the codes I am using and ALL that is happening is I am returned to the
login page everytime, if I enter correct or false data and NO error
message...PLUS there is no login happening. !. I put this code in the BODY ON
THE PAGE I want to secure: (The login form does show up on the page just does
nothing) <body> <cfif not len(getAuthUser())> <cfset request.loginmessage =
'You need to Log In.'> <cfinclude template='../LogIn/ForceUserLogIn.cfm'>
</cfif> <!-- Get authorized user suppled in Name of login tag --> <cfset
ContactName = ListFirst(GetAuthUser())> <cfoutput> <h2>Add or Edit a
Event</h2> WELCOME BACK, #ContactName# </cfoutput> </body> I then have a login
form; <!--- If the user is now submitting the 'login' form, include 'Login
Check' code ---> <!--- to validate user ---> <cfif IsDefined('Form.UserLogin')>
<cfinclude template='LoginCheck.cfm'> </cfif> <html> <head> <title>Log
In</title> <meta http-equiv='Content-Type' content='text/html;
charset=iso-8859-1'> </head> <body> <!--- Start our Log in Form ---> <cfform
action='#CGI.SCRIPT_NAME#' name='LoginForm' method='post'> <!--- Make the
UserLogIn and UserPass fields required ---> <input type='hidden'
name='UserLogIn_required'> <input type='hidden' name='UserPass_required'>
<table border='0' bgcolor='#FFFF00' align='right'> <tr><Th colspan='2'>Please
Log in</Th></tr> <tr></tr> <tr></tr> <tr> <th>User Name (Alias): </th> <td>
<!--- text field for user name 'Alias' ---> <cfinput type='text'
name='UserLogIn' size='20' value='' maxlength='100' required='yes'
message='Please type your user name AKA Your User Alias'> </td> </tr> <tr></tr>
<tr></tr> <tr></tr> <tr> <th>Password: </th> <td> <!--- text field for
Password ---> <cfinput type='password' name='UserPass' size='20' value=''
maxlength='100' required='yes' message='Please insert your user password.'>
<!--- Submit button that reads submit ---> <input type='submit' value='Log In'>
</td> <td> </td> </tr> </table> <table> <tr> <td> </td> <td><font size='+1'
face='Comic Sans MS, MS Serif, Arial'> Forgot your password? </font> <font
face='Comic Sans MS, MS Serif, Arial'> Send it to your registered Email address
</font> </td> <td> </td> <td> <a name='' onClick='window.open('./to
email.cfm')'> <img src='../Images/fastemail.gif'> </td> </tr> </table>
</cfform> <cfinclude template='../head and foot/footer.cfm'> </table>
<cfinclude template='LogInFocus.cfm'> </body> </html> I then have a check if
they are logged in form; <!--- validates a user login name and password --->
<!--- first make sure we have a login name and password ---> <cfparam
name='Form.UserLogIn' type='string'> <cfparam name='Form.UserPass'
type='string'> <!--- find record with this user name and password ---> <!--- if
no rows returned one or both are not valid ---> <cfquery name='GetUser'
datasource='#REQUEST.DataSource#'> SELECT UserID, UserLogIn, UserCity,
UserState, UserCounty, UserCountry FROM Users WHERE UserLogIn
='#Form.UserLogIn#' AND UserPass ='#Form.UserPass#' </cfquery> <!--- If the
username and password are correct ---> <cfif GetUser.RecordCount EQ 1> <!---
remember user's logged in status, plus ---> <!--- UserID and UserLogin name in
structure ---> <cfset SESSION.Auth = StructNew()> <cfset
SESSION.Auth.IsLoggedIn = 'yes'> <cfset SESSION.Auth.UserID = GetUser.UserID>
<cfset SESSION.Auth.UserLogIn = GetUser.UserLogIn> <!--- Now that user is
logged in, send them to whatever page they were trying to access --->
<cflocation url='#CGI.SCRIPT_NAME#'> </cfif> Nothing seems to be working
please help. I do not want a site that people have to log in to see anything as
with application. I only want to secure the areas where the user can add or
update their own info and for the site admin. Thank you John:confused;
nckgb Guest
-
cflogin
Hi, I'm using cflogin to build a simple application. If a user forgets their password, then they get asked a security question and if they answer... -
Using <cflogin>
Is there a way to use CFLOGIN without requiring cookies? If so, how? -
cflogin problem
I am using coldfusion authentication architecture to get the users logged in to my system. Authentication is working ok but it is giving me... -
Doesn't ANYBODY know anything about cflogin???
:Q Do the people on this forum not know anything about cflogin OR is it they do not wish to share??? I posted a ? a week ago and I am still waiting... -
cflogin HELP
Hi I need some help. Ifind lots of tutorials for simple login and for using cflogin in the Application...BUT nothing about using cf_login for single... -
mpwoodward *TMM* #2
Re: cflogin confusion
nckgb wrote:
Unless I'm just missing it I don't see that you're using cflogin or> Hi I need some help. Ifind lots of tutorials for simple login and for using
> cflogin in the Application...BUT nothing about using cf_login for single pages.
> Here are the codes I am using and ALL that is happening is I am returned to the
> login page everytime, if I enter correct or false data and NO error
> message...PLUS there is no login happening. !. I put this code in the BODY ON
> THE PAGE I want to secure:
cfloginuser anywhere on this page, so getAuthUser() is never going to
return anything. Think of cflogin this way. Anything you put between
your cflogin tags is only going to get executed if someone is not logged
in, so for example you could put your login form in your cflogin tags.
Also in my experience you have to have your cfloginuser tag inside a
cflogin tag for it to work properly, so you'd have to do a check for the
form submission, validate the user, and if that's successful then log
the user in. There is a very basic example here that illustrates this:
[url]http://tinyurl.com/5lqy6[/url]
Whether you want to apply this to your entire site or one page, the
principle would be the same.
Hope that helps!
Matt
--
Matt Woodward
Team Macromedia - ColdFusion
mpwoodward *TMM* Guest
-
nckgb #3
Re: cflogin confusion
HIi Matt I did forget to put in the code I am using for ForceUserLog.cfm in my
? It is here <body> <cfif not len(getAuthUser())> <cfset request.loginmessage
= 'You need to Log In.'> <cfinclude template='../LogIn/ForceUserLogIn.cfm'>
<<<<<<!--- HERE --->>>>>> </cfif> And here is that pages code.
<!--- Force the user to log in ---> <!--- This code executes only if the user
has not logged in ---> <!--- Once the user is logged in via <cfloginuser>, this
code will be skipped ---> <cflogin> <!--- If the user hasn't gotten the login
form yet, display it ---> <cfif NOT (IsDefined('FORM.UserLogin') AND
IsDefined('FORM.UserPassword'))> <cfinclude template='LoginForm.cfm'>
<cfabort> <!--- Otherwise, the user is submitting the login form --->
<!--- This code decides wheather the username and password are valid --->
<cfelse> <!--- Find record with this Username/Password ---> <!--- If
no rows returned, password not valid ---> <cfquery name='Logged'
datasource='#REQUEST.DataSource#'> SELECT UserID, UserLogIn, UserPass,
UserRoleName FROM Users WHERE UserLogIn = '#FORM.UserLogIn#' AND
UserPass = '#Form.UserPass#' </cfquery> <!--- If the user name and password
are correct ... ---> <cfif Logged.RecordCount EQ 1> <!--- Tell CF to
consider the user logged in ---> <!--- For the name attribute, we will provide
the user alias(UserLogin), seperated by commas. Later we can access the NAME
value via GetAuthUser() ---> <cfloginuser
NAME='#Logged.UserID#,#Logged.UserLogIn#' PASSWORD='#FORM.UserPass#'
roles='#Logged.UserRoleName#'> <!--- Otherwise, re-prompt for a valid username
and password ---> <cfelse> Sorry, we do not know this User Name OR Password.
Please try again. <cfinclude template='LogInForm.cfm'> <<<<< <!--- HERE
-->>>>>>< <cfabort> </cfif> </cfif> </cflogin> The cfform code is in the
Log in form itself. that is include in the ForceUserLogin.cfm Thanks for any
more help, soory I missed the other code. After hours of flustration, you start
to lose it.
nckgb Guest



Reply With Quote

