Hi Gerard;
There would be many ways to do this - one way would be to put some
logic in the User model beforeValidate method that checks if password
field is set in the data but blank, then password field is unset - so
it won't be validated or saved.
eg.
function beforeValidate(){
    if (isset($this->data['User']['pwd'] && strlen($this->data['User']
['pwd'])==0)){
        unset($this->data['User']['pwd]);
    }
    return true;
}
If you do this you'll have to hash your own password rather than let
Auth do it automatically, because Auth will hash a blank password and
the 'if' condition will never be true.

On Aug 24, 12:04 am, gedm <gerard.me...@gmail.com> wrote:
> I'm wondering how the cakephp bakery site ignores the blank password
> field when a user is updating their profile?
>
> That is, if the password is left blank it updates the other fields in
> the record but does not clear the password when the record is saved.
> How is this done?
>
> Thanks
--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to