As an addendum, you could also do what I did in my current project to ensure that only certain fields DO validate when saving a model. This would allow you to use the method I included in my last post (specifying the fields you wish to save) while also allowing validation to work. Take a look at this method I created within app_model.php that gets inherited by all models within the app:
http://groups.google.com/group/cake-php/msg/dd21b207447b6206 On Jun 6, 3:49 pm, Matt Huggins <[EMAIL PROTECTED]> wrote: > You could specify which fields to save, including all the fields you > need to update, and excluding the password field. However, you won't > be able to validate the model if you do this since password will > always be invalid. > > if ($this->User->save($this->data, false, array('username', 'email'))) > { > // ... > > } > > On Jun 6, 3:42 pm, benjam <[EMAIL PROTECTED]> wrote: > > > If you'll notice in my controller method, that's exactly what I do, > > but because it's already hashed, it's not empty, it's a hash of an > > empty string. > > > I need to find a way to delete it before it gets hashed. And it gets > > hashed before the data gets to the method. So I need to find a way to > > delete it even before that. > > > On Jun 6, 2:38 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote: > > > > On Fri, Jun 6, 2008 at 4:33 PM, benjam <[EMAIL PROTECTED]> wrote: > > > > I was wondering if there was a way to prevent it from hashing the > > > > password if there is no password entered? > > > > Well, before you save the data when you're editing, you could unset > > > the password field. > > > > i.e. unset($this->data['User']['password'] > > > > Totally untested. Hope that helps. > > > > -- > > > Chris Hartjes > > > Internet Loudmouth > > > Motto for 2008: "Moving from herding elephants to handling snakes..." > > > @TheKeyBoard:http://www.littlehart.net/atthekeyboard --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
