If you are using the Auth component, Auth will hash the blank
password.

The workaround I've found for this is to use a dummy password field
(e.g. new_password) instead of the real password field, then in your
controller::save() do

if (!empty($this->data) {

    if (!empty($this->data['Model']['new_password']) {
        $this->data['Model']['password'] = $this->Auth->password($this-
>data['Model']['new_password'];
    }

    if ($this->Model->save($this->data) {
        // data saved
    }
    else {
        // there was an error in the form submission
    }

}

On May 28, 6:30 pm, Bryan Paddock <bryanpadd...@gmail.com> wrote:
> Hiya all
> Weird problem here - in my users/edit function i have a form for updating
> your user information
>
> If you submit the form with a blank password (so the user is not changing
> their password) then cake decides to change the password anyways!
>
> I have tried fixing it in my own code but nothing seems to work:
>
> if (! $this->data['User']['password']) {
>   unset($this->data['User']['password']);
>
> }
>
> but that doesnt work because cake hashes the (blank) password before it even
> reaches the function
>
> any ideas why its doing this?
--~--~---------~--~----~------------~-------~--~----~
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