Ok i got it all working now, unsetting the field did work
here is what i did in my model:

function beforeValidate() {
                        $u = &$this->data['User'];
                        $p1 = &$u['password'];
                        $p2 = &$u['password1'];
                        if ($p1 != $p2) {
                                $this->set('error', 'Passwords do not match');
                                return false;
                        }
                        if (empty($p1)) {
                                unset($this->data['User']['password']);
                        }
                        return true;
        }

        function beforeSave() {
                if ($this->validates()) {
                        if (isset($this->data['User']['password'])) {
                                $this->data['User']['password'] = 
md5($this->data['User']
['password']);
                        }
                        return true;
                }

                return false;
        }


controller:
        function edit_profile() {
                $this->User->id = $this->Session->read('User.id');
                if (empty($this->data))
                {
                        $this->data = $this->User->read();
                }
                else
                {
                        if ($this->User->save($this->data)) {
                                $this->flash("Your profile has been saved.", 
'/users/profile');
                        }
                }
        }


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to