By completely changing the code.

function hashPasswords($data, $enforce = false) {
        if ($enforce && isset ($this->data[$this->alias]['password'])) {
                if (!empty ($this->data[$this->alias]['password'])) {
                        $this->data[$this->alias]['password'] = Security :: 
hash($this->data
[$this->alias]['password'], null, true);
                }
        }
        return $data;
}
function beforeSave() {
        $this->hashPasswords(null, true);
        return true;
}

On 30 jan, 01:46, "[email protected]" <[email protected]>
wrote:
> So, How did you solve it?
>
> On Jan 29, 8:11 pm,Deliriumtremens<[email protected]> wrote:
>
> > This part of the problem has been solved.
>
> > On 29 jan, 20:41,Deliriumtremens<[email protected]> wrote:
>
> > > The following code does not work.
>
> > >     function hashPasswords($data) {
> > >         return $data;
> > >     }
> > >     function beforeSave() {
> > >             $this->data['Account']['password'] = 
> > > Security::hash($this->data
> > > ['Account']['password'], null, true);
> > >             return true;
> > >     }
>
> > > Can you figure out why?
>
> > > On 29 jan, 19:51,Deliriumtremens<[email protected]> wrote:
>
> > > >     function hashPasswords($data, $enforce=false) {
> > > >             if($enforce && isset($data['Account']['password'])) {
> > > >             if(!empty($data['Account']['password'])) {
> > > >                 $data['Account']['password'] = Security::hash($data
> > > > ['Account']['password'], null, true);
> > > >             }
> > > >         }
> > > >         $this->data = $data;
> > > >         pr($this->data);
> > > >         return $data;
> > > >     }
> > > >     function beforeSave() {
> > > >         $data = $this->data;
> > > >         pr($data);
> > > >             $this->hashPasswords($data, true);
> > > >             return true;
> > > >     }
>
> > > > The first pr prints an array with email and password (hashPasswords is
> > > > called twice, it should print an unencrypted password, then print an
> > > > encrypted password). The second pr does not print anything. How to
> > > > solve this problem?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to