An alternative perspective is that "theUser" should not know how to "authenticate" itself.

Rather, you might have an "Authenticator" that knows how to do everything that has anything to do with authentication, which can be passed the un/pw.

"theUser" might have some kind of state ("isAuthenticated"), but even there you might ask the Authenticator (or some other authentication-related state checker) rather than coupling notions of authentication with theUser itself.






[EMAIL PROTECTED] wrote:
Why do you need a method to a login screen? Wouldn’t a login screen be more of a display compared to a logic object?

You need to think about the objects involved, rather than the processes.

You have a user…  What does that user want to do?  Authenticate, or Login.

Object = theUser

Method = public Authenticate(Login, Password) as Bool

This way, you can “ask” the user if they are logged in when you need to check the authentication of a certain page. This user object can also hold their name, email, access keys, if they are authenticated, their login, etc..

So, I would have the following in the page that the login form posts to :

*If (theUser.Authenticate(form.login, form.password))*

*{*

*   // login is good, do what we need to do here*

*}*

*Else*

*{*

*  // login is bad.  Tell the user and re-ask for username / password here*

*}*

Hope this helps, at least a little bit.

-Nick

------------------------------------------------------------------------

*From:* [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] *On Behalf Of *Stephen Adams
*Sent:* Tuesday, July 12, 2005 10:44 AM
*To:* cfcdev@cfczone.org
*Subject:* [CFCDev] OOP and creating a login section

Hi everyone,

When I'm trying to move to a more OOP style of building CF applications, I always find that when it comes to building sections like a login section or a message recording form, I can't relate OO to it. When I read examples in both Java and CF they are always cars, people or animals. I find it hard to turn the idea of having properties and methods to a login screen. Then I find I fall back into procedural programming.

How do those who do use OOP create login screens or forms?

Stephen
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to cfcdev@cfczone.org with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm

An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to cfcdev@cfczone.org with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm

An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to 
cfcdev@cfczone.org with the words 'unsubscribe cfcdev' as the subject of the 
email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm

An archive of the CFCDev list is available at 
www.mail-archive.com/cfcdev@cfczone.org


Reply via email to