public function executePassword($request) { $user = $this->getUser(); $this->form = $form = new PasswordForm($user); if ($request->getMethod() == sfRequest::POST) { $form->bind($request->getPostParameters()); if ($form->isValid()) { $user->setPassword($form->getValue('password')); $user->setAuthenticated(false); //$user->setFlash('notice','Password changed'); return $this->redirect('@homepage'); } } }
function changepasswordAction() { $this->view->activeTab = 'Profile'; $this->view->title = $this->view->translate("Wildfire") . " - " . $this->view->translate("Change_Password"); $form = new PasswordForm(); $consumerModel = new Consumer(); if ($this->_request->isPost()) { //POST $formData = $this->_request->getPost(); if ($form->isValid($formData)) { if ($formData['newpassword'] == $formData['repeat']) { $id = $this->_currentUser->id; $consumer = $consumerModel->find($id)->current(); if ($consumer->password == md5($formData['oldpassword'])) { $consumer->password = md5($form->getValue('newpassword')); $consumer->save(); $form->populate($consumer->toArray()); $this->view->showMessage = $this->view->translate('Save_Successfully'); } else { $this->view->showMessage = $this->view->translate('Password_is_wrong'); } } else { $this->view->showMessage = $this->view->translate('New_password_and_repeat_must_be_consistent'); } } // Zend_Debug::dump($this->veiw->showMessage); } else { //GET $email = $this->_currentUser->email; $form->setDefault('email', $email); } $this->view->form = $form; }