which cake version are you using ?

and, for hashing method use AuthComponent::password instead :)
--
Lep pozdrav, Tilen Majerle
http://majerle.eu



2011/12/1 heohni <[email protected]>

> Hi,
>
> when I want to add a new user, I want to add an "auto" login value for
> username and password.
>
> The user is entering some data into a form which I can validate and
> before I do the
> if ($this->User->save($this->data)) {
>
> I need to set the fields for username and password, right?
>
> I tried:
> $this->data['User']['username'] = 'test1';
> $this->data['User']['password'] = 'test2';
>
> In my model I have
> function beforeSave(){
>        $this->hashPasswords(NULL, TRUE);
>        return true;
>    }
> function hashPasswords($data){
>        if(isset($this->data['User']['password'])){
>            $this->data['User']['password'] = Security::hash($this-
> >data['User']['password'], NULL, TRUE);
>            return $this->data;
>        }
>        return $this->data;
>    }
>
> But for some reason both database fields ALWAYS are empty :-(
>
> What I am doing wrong?
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> [email protected] For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to