The user is not saved. The tutor is saved but not the user. On Mar 4, 6:38 pm, Tilen Majerle <[email protected]> wrote: > now, user is saved ? > > if it's still not, then is problem FOR user in validation, after call > save() method for User, debug($this->Tutor->User->validationErrors); > > i'm sure you failed with $this->request->data('PASSWORDTUTOR') > -- > Lep pozdrav, Tilen Majerlehttp://majerle.eu > > 2012/3/4 Cédric Chabert <[email protected]> > > > > > > > > > Thank you for this answer ! > > > Actually there is validated beforeSave, and the password is hashed. > > > class User extends AppModel { > > public $name = 'User'; > > > public $hasOne = 'Tutor'; > > > public $validate = array( > > 'username' => array( > > 'required' => array( > > 'rule' => array('notEmpty'), > > 'message' => 'A username is required' > > ) > > ), > > 'password' => array( > > 'required' => array( > > 'rule' => array('notEmpty'), > > 'message' => 'A password is required' > > ) > > ), > > 'role' => array( > > 'valid' => array( > > 'rule' => array('inList', array('student','tutor')), > > 'message' => 'Please enter a valid role', > > 'allowEmpty' => false > > ) > > ) > > ); > > > public function beforeSave() { > > if (isset($this->data[$this->alias]['password'])) { > > $this->data[$this->alias]['password'] = > > AuthComponent::password($this->data[$this->alias]['password']); > > } > > return true; > > } > > } > > > On Mar 4, 6:01 pm, Tilen Majerle <[email protected]> wrote: > > > $dataUser should be something like this > > > > $dataUser = array('User' => array('username' => $this->request- > > > > >data('LOGINTUTOR'), 'password' => $this->request- > > > >data('PASSWORDTUTOR'), 'role' => 'tutor')); > > > > and make sure that model is not validated before save, maybe here is > > > problem too :) > > > -- > > > Lep pozdrav, Tilen Majerlehttp://majerle.eu > > > > 2012/3/4 Cédric Chabert <[email protected]> > > > > > $dataUser = array('username' => $this->request- > > > > >data('LOGINTUTOR'), 'password' => $this->request- > > > > >data('PASSWORDTUTOR'), 'role' => 'tutor'); > > > -- > > Our newest site for the community: CakePHP Video Tutorials > >http://tv.cakephp.org > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help > > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > > [email protected] For more options, visit this group > > athttp://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
