/** * IS: Parameter oldPassword, newPassword, newPassword2 terdeklarasi * FS: - * Desc: Fungsi yang mengatur aksi untuk proses change password */ public function changeAction() { if ($this->getRequest()->isXmlHttpRequest()) { $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); // Param $oldPassword = $this->_getParam('oldPassword'); $newPassword = $this->_getParam('newPassword'); $newPassword2 = $this->_getParam('newPassword2'); // Form $form = new Form_ChangePasswordForm(); // Model $userDb = new Model_DbTable_User(); // Data $userId = $userDb->getUserById($this->_sess->userId); header('Cache-Control: no-cache'); if ($userId['password'] != md5($oldPassword)) { echo 'Your old password is incorrect'; } elseif ($newPassword != $newPassword2) { echo 'Your confirm password is not match'; } else { $userDb->resetPass(md5($newPassword), $this->_sess->userId); echo 'success'; } } }