3 Replies Latest reply on May 26, 2014 4:27 AM by zassadgh

    Remember password functionality.

    Bhushan Phalak

      How i implement a login process with remember password  functionality and remember multipal username ad password.

        • 1. Re: Remember password functionality.
          Vikash.kumar29 Level 3

          Hi Bhushan,

           

           

          Try using shared object, Which you can write after login and read before login process to save your credentials. You might also be instrested in some encrytion logic to perform before save operation.

           

          -Regards

          Vikash Kumar

          • 2. Re: Remember password functionality.
            vj_mvk_dev

            Can you please post some code for remembering username and password functionality in flex. I am a newbie to flex and it is urgent requirement for me now. Please.

            • 3. Re: Re: Remember password functionality.
              zassadgh

              You might already have fixed your problem, but if anybody else looks at this thread, they will not have, here is how I would have done it.

              Pseudo code:

              import com.adobe.crypto.MD5;
              import spark.managers.PersistenceManager;
              var myDataManager:PersistenceManager = new PersistenceManager();
              
              //Login normally and execute 'loginCorrect' if it is correct.
                         protected function loginCorrect():void {
                             if (checkboxRemeberPassword.toggle == true){   //now we know that we will save the username and password
                                  saveLoginInfo(textboxUserName.text,textboxPasswordRaw.text)
                              }
                          }
                        protected function saveLoginInfo(UserName:String,PasswordRaw:String):void
                          {
                             var PasswordHash:String = MD5.hash(PasswordRaw);
                              SavePersistenceData("UserName",UserName);
                              SavePersistenceData("UserName"+":"+"Password",PasswordHash);
                          }
              
                        protected function textboxUserName_changeHandler(event:TextOperationEvent):void
                          {
                             if (String(LoadPersistenceData(textboxUserName.text+":"+"Password")).count => 1){
                                  textboxPasswordRaw = "********" //display demo password
                                  //Display maybe lable - User's Saved Password found or just auto login?
                             }
                          }
              
              // to find the hash password for the user
              String(LoadPersistenceData(textboxUserName.text+":"+"Password"))
              
              //put this in a class somewhere, they are function to load saved data from persistence data, should be safe enought.
                        public function SavePersistenceData(myPropertyName:String, myPropertyData):void
                        {
                            myDataManager.setProperty(myPropertyName, myPropertyData);
                        }
                        public function LoadPersistenceData(myPropertyName:String)
                        {
                       var myResult;      
                            if(myDataManager.load())
                            {
                           var savedData:Object = myDataManager.getProperty(myPropertyName);
                           if(savedData)
                           myResult = savedData;
                       }
                      return (myResult);
                      }
              
              
              
              
              
              
              
              
              

              I am new to as3, but this would be my way to do it.
              code has not been tested, there might be a few small errors with syntax, but that should be a quick fix