Trying to write a controller to change the password. The only guide I have found to do this is at the following: http://groups.google.com/group/cake-php/browse_thread/thread/83359000910910c5/63972a85d3d5b011?lnk=gst&q=change+password&rnum=1
However this appears to be using cake 1.x (because of the html helper being used for a form). When using this controller I get this Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /var/www/ cake/app/controllers/users_controller.php on line 68 This is at the 'if($this->data['change']['newpassword'] !=.....' line. Here is the code I am trying. Let me know if there is a better way to do this in Cake 2. Cheers, Damo function changepassword() { if (!empty($this->data)) { $user = $this->Session->read('User'); $this->User->id = $user['id']; $someone = $this->User->findById($this->User->id); if(md5($this->data['change']['oldpassword']) != $someone['User']['password']) { $this->User->invalidate('oldpassword', 'Your old password is invalid'); } if($this->data['change']['newpassword'] != this- >data['change']['confirmpassword']){ $this->User->invalidate('newpassword', 'Your passwords do not match'); $this->User->invalidate('confirmpassword', 'Your passwords do not match');} else { $encryptedPassword = md5($this->data['change'] ['newpassword']); $this->data['User']['password'] = $encryptedPassword; $this->data['User']['id'] = $this->User->id; } if ($this->User->save($this->data)){ $this->flash('Password updated, please login again.','/ users/logoutnf'); } else { $this->render(); } } } --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---