Thanks.  How does this make it more secure?

-----Original Message-----
From: Sean A Corfield [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 04, 2003 4:20 PM
To: CF-Talk
Subject: Re: CFC set's & get's


On Tuesday, Feb 4, 2003, at 11:35 US/Pacific, Andy Ousterhout wrote:
> What do you mean "unnamed" scope.

Variables without the "this." prefix.

> In the following code, how would you implement this concept?:
>
> <cfcomponent extends="person" displayname="User">
>
>       <!--- Create a single handle for the instance data ... --->
>       <cfscript>
>               this.UserKey = 0;
>               this.CustomerKey = 0;
>               this.ID = "";
>               this.Password = "";
>               this.LastLoggedInOn=0;
>               this.MustChangePW = false;
>       </cfscript>

Replace <cfscript>..</cfscript> with:

        <cfscript>
                // 'instance' is in unnamed scope and
                // therefore not accessible outside the
                // CFC object:
                instance = structNew();
                instance.UserKey = 0;
                instance.CustomerKey = 0;
                instance.ID = "";
                instance.Password = "";
                instance.LastLoggedInOn=0;
                instance.MustChangePW = false;
        </cfscript>

Note, you could also do this:

        <cfscript>
                UserKey = 0;
                CustomerKey = 0;
                ID = "";
                Password = "";
                LastLoggedInOn=0;
                MustChangePW = false;
        </cfscript>

>       <cffunction name="getID" access="public" returntype="string"
> output="false">
>               <cfreturn this.ID>

Change to either:

                <cfreturn instance.ID>
or (second form)
                <cfreturn ID>

>       </cffunction>
>
>       <cffunction name="setPassword" access="public" output="false">
>
>               <!--- Arguments: --->
>                       <cfargument name="Password1" type="string" required="true"
> hint="Password
> to set">
>                       <cfargument name="Password2" type="string" required="true"
> hint="Confirm
> Password">
>
>               <!--- If passwords don't match, throw error ... --->
>               <cfif Compare(arguments.Password1, arguments.Password2)>
>                       <cfthrow errorcode="setPassword 01"
>                               message="Passwords did not match.  Please re-enter."
>                               type="User" >
>               <cfelse>
>                       <cfset this.Password = arguments.Password1>

Change to either

                        <cfset instance.Password = arguments.Password1>
or (second form)
                        <cfset Password = arguments.Password1>

>               </cfif>
>
>               <cfreturn this>
>       </cffunction>
> </cfcomponent>


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to