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, "BiosElem...@gmail.com" <BiosElem...@gmail.com>
wrote:
> So, How did you solve it?
>
> On Jan 29, 8:11 pm,Deliriumtremens<pedbe...@gmail.com> wrote:
>
> > This part of the problem has been solved.
>
> > On 29 jan, 20:41,Deliriumtremens<pedbe...@gmail.com> 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<pedbe...@gmail.com> 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 cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment