Hi, what I do when updating User details without a password is simply removing the validation in the controller before the model 'save' method is called :
unset($this->User->validate['password']); Friendly greetings, Bert So by default I validate it, On Fri, Aug 21, 2009 at 7:59 AM, DavidH<djhollingwo...@gmail.com> wrote: > > Thinking about it further the use of 'on' => 'create' isn't going to > do it for me because there will be a separate update facility. I guess > I could > > 1. Pass the password through the edit view in a hidden field, or > 2. When editing the user details (but not the password) get the > current password from the database and inject it into the data, which > I think would be much more secure than option 1 > > I guess that would work. Then I can use the same validation in all > cases. > > David > > On Aug 20, 8:17 pm, majna <majna...@gmail.com> wrote: >> You can set password validation only for >> add:http://book.cakephp.org/view/127/One-Rule-Per-Field >> using 'on' => 'create', // or: 'update' >> >> Or hack like unset($this->Model->validate['password'] :) >> >> On Aug 20, 6:58 pm, DavidH <djhollingwo...@gmail.com> wrote: >> >> > Hi >> >> > Is there a simple way to do this? I have a UsersController and User >> > method that does a dose of validation on the username and passwords >> > fields (as per this excellent tutorialhttp://tinyurl.com/52robw). >> >> > It works fine on the add; but when invoking the edit I don't want the >> > users passwords to be updated (this will; be done through a separate >> > view) and so I don't want any validation to fire for the password >> > field. >> >> > I saw that you can turn validation off in the save() method; but that >> > seems to be for all fields. Is there a way to turn of validation on >> > specific fields? Or do I have to write a customer validation method >> > that recognises which action has been invoked? >> >> > Cheers >> >> > David > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---