Tuesday, May 29, 2012

Re: How I can edit a user without changing the password?

Thanks euromak.

I like the solution to check if it is empty but ... How do I distinguish between "add action" and "edit action"?
If I add a new user the password should be mandatory.
If I edit the user then the password is blank if not modified.

Another thing .... How can see the current value of the field in database? For example

function beforeSave(){
     if(empty($this->data[$this->alias]['password']))
            $this->data[$this->alias]['password'] = currentPassword;  // hash password stored in data base
     else
            $this->data[$this->alias]['password'] = AuthComponent::password($this->data[$this->alias]['password']);

return true;
}

Thanks!


--
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

No comments: