Re: How to use Auth in Model
I use it this way in cake2:
public function beforeSave($options = array()) {
$password_unhashed = $this->data[$this->name]['password'];
$this->data[$this->name]['password'] = AuthComponent::password($password_unhashed);
return true;
}
Andras Kende
On Jun 14, 2012, at 11:20 PM, Mangesh Sathe wrote:
Hello all ,
i am using $this->Auth->password in User model.
it gives errorNotice (8): Undefined property: User::$Auth [APP/models/user.php, line 48]
how can i access Auth in model & How can i encode password before save?
function beforeSave() {
$this->data['User']['password'] = $this->Auth->password($this->data['User']['password']);
return true;
}
Thanks in advance,
Mangesh Sathe--
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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home