used as a log-in check. That's exactly what it is (and that's all that it
is). GetAuthUser(), by definition, returns the username of the current
user. You happen to be able to use both to determine whether or not someone
is logged-in... I'm not sure whether there's any performance difference
between the two (I'd think <cflogin> would be quicker in determining if
someone's logged-in, but the difference would never be significant enough to
matter anyway). So I guess it's really just a personal preference thing. I
use both... if I'm in the display layer, I like <cflogin>. If I'm anywhere
else, I generally use getAuthUser().... primarily because so much of my code
is <cfscript>.
~Simon
Simon Horwith
CTO, Etrilogy Ltd.
Member of Team Macromedia
Macromedia Certified Instructor
Certified Advanced ColdFusion MX Developer
Certified Flash MX Developer
CFDJList - List Administrator
http://www.how2cf.com/
-----Original Message-----
From: Raymond Camden [mailto:[EMAIL PROTECTED]
Sent: 06 February 2004 16:48
To: CF-Talk
Subject: RE: Another CFLogin issue - Roles
> Ray,
> What about a situation where you have certain display
> elements that only show to logged-in users? Why not wrap
> <cflogin> around those elements? I know you're immediate
> answer is "use conditional logic to see if
> getAuthUser()returns an empty string", but I don't see why
> one is better than the other. Using getAuthUser() means
> using conditional logic (yes, I know that <cflogin> is an
> explicit conditional check) which is more sore on the eyes
> and requires a developer to expend more thought in order to
> figure out what the conditional logic is. <cflogin> is
> intended to be wrapped around code to run when people aren't
> logged in. GetAuthUser() is supposed to return the name of
> the logged-in user. Right now, getAuthUser() happens to
> return an empty string when you're not logged in, but that
> functionality
> isn't set in stone. If that functionality is set in stone,
> I still think
> <cflogin> leaves less doubt about the intention of the code.
> Thoughts?
>
In my mind, <cflogin> should not be used as a login check. It should only
be
used to manage the login system as whole. Sure it _acts_ a bit like a
conditional check, but that is not its true purpose. This to me is enough
to
say that getAuthUser is better than <cflogin> for determining if a user is
logged in.
Why do you say GetAuthUser() is not set in stone? That can be applied to
_any_ function. Even if MACR changed it so that users not logged in
returned
XXX or somesuch, you could use use it as a way to see if the user is
authenticated.
As a side note, you _can_ use <cflogin> to determine if the user is logged
in. For a site where logins are optional, you can have this in
Application.cfm:
<cflogin>
<cfset request.userisloggedin = false>
<!--- normaly code here o handle potential log ons, and set the
request var above to true if need be --->
</cflogin>
someotherfile.cfm:
<cif request.userisloggedin>
.....
</cfif>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

