Here’s a Login sample app (rename to samples.zip) that uses the RemoteObject.setRemoteCredentials(username, password) and the ColdFusion CFLOGIN container.

 

Unzip it to your web server’s doc root.  In flex builder create a new Flex project of type “ColdFusion Flash Remoting Service”.  Fill out the prompts and specify “LoginTest.mxml” as your Main application file.

Here’s a code snippet from the app and it breaks down like this

 

 

In the MXML

 

                                    private function logIn():void

                                    {

                                                // all this does is set the credentials - these are not sent over until the first actual request is made

                                                // set the RemoteObject

                                                cf.setRemoteCredentials(this.username.text, this.password.text);

                                                loginbtn.enabled = false;

                                                logoutbtn.enabled = true;

                                    }

 

                                    private function logOut():void

                                    {

                                                //Alert.show("logout");

                                                loginbtn.enabled = true;

                                                logoutbtn.enabled = false;

                                                cf.setRemoteCredentials(null, null);

                                                cf.logout();

                                                cf.logoutuser();

                                    }

 

                        <mx:FormItem direction="horizontal">

                                    <mx:Button id="loginbtn" label="Login" click="logIn();"/>

                                    <mx:Button id="logoutbtn" label="Logout" click="logOut()"  enabled="false"/>

                        </mx:FormItem>

 

The CFML included in the app uses the CFLOGIN structure as per CF best practices of usage of this feature.

 

Also note that as part of the new Super Wizard for Flex Builder 2.0 produced by the CF team includes an option to build-in a login scheme (includes a well-formatted login page with user name and password field prompts and the appropriate cfc backend logic).

 

Bill  


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Tom Chiverton
Sent: Friday, May 19, 2006 4:12 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Login System

 

On Thursday 18 May 2006 17:52, s_hernandez01 wrote:
> code up the login system.  Would anybody know how to start that, or
> know of any references that would help me get started.  I know that

I'd have the Flash send the username/password to the CF over HTTPS.
The CF creates a per-session token and gives that back to the Flash.
The Flash then gives that token as the first argument to all other server
functions.

Obviously some small wibbles with CF keeping track of tokens, validating and
expiring them etc., but I'm not gonna write it all out here :-)

--
Tom Chiverton

****************************************************

This email is sent for and on behalf of Halliwells LLP.

Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at St James's Court Brown Street Manchester M2 2JF.  A list of members is available for inspection at the registered office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP. Regulated by the Law Society.

CONFIDENTIALITY

This email is intended only for the use of the addressee named above and may be confidential or legally privileged.  If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents.  If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 8008.

For more information about Halliwells LLP visit www.halliwells.com.

We are pleased to announce that Halliwells LLP has been voted AIM Lawyer of the Year at the 2005 Growth Company Awards





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com



SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Attachment: samples.piz
Description: samples.piz

Reply via email to