示例#1
0
 public function changepasswordAction()
 {
     global $mySession;
     $db = new Db();
     $this->view->pageTitle = "Change Password";
     $myform = new Form_Resetpassword();
     $varsuccess = 0;
     if ($this->getRequest()->isPost()) {
         $request = $this->getRequest();
         $dataForm = $myform->getValues();
         if ($myform->isValid($request->getPost())) {
             $dataForm = $myform->getValues();
             //prd($dataForm);
             $myObj = new Users();
             $Result = $myObj->ChangePassword($dataForm);
             if ($Result != '0') {
                 $mySession->sucessMsg = "Your Password successfully changed";
                 $varsuccess = 1;
             } else {
                 $mySession->errorMsg = "Please enter correct old password";
             }
         } else {
             $mySession->errorMsg = "Password do not match";
         }
     }
     $this->view->myform = $myform;
     $this->view->varsuccess = $varsuccess;
 }
示例#2
0
 public function processresetAction()
 {
     //echo "=====aa";die;
     global $mySession;
     $db = new Db();
     $this->_helper->layout->setLayout('myaccount');
     $this->view->pageTitle = "Reset Password";
     $requestId = $this->getRequest()->getParam('requestId');
     //echo "rrrr".$requestId;die;
     $chkData = $db->runQuery("select * from " . USERS . " where pass_reset='" . $requestId . "'");
     if ($chkData != "" and count($chkData) > 0) {
         //echo "aa";die;
         $this->view->requestId = $requestId;
         if ($this->getRequest()->isPost()) {
             //echo "yy";die;
             $request = $this->getRequest();
             $myform = new Form_Resetpassword();
             if ($myform->isValid($request->getPost())) {
                 //echo "validd";die;
                 $dataForm = $myform->getValues();
                 if ($dataForm['newpassword'] != $dataForm['cnfrmpassword']) {
                     //echo "kk";die;
                     $mySession->errorMsg = "New password and confirm new password should be same.";
                     $this->view->myform = $myform;
                     $this->render('reset');
                 } else {
                     //echo "ww";die;
                     $myObj = new Users();
                     $Result = $myObj->ResetNewPassword($dataForm, $requestId);
                     $mySession->errorMsg = "Your new password reset successfully.";
                     $this->_redirect('login/index');
                 }
             } else {
                 //echo "not valid";
                 $this->view->myform = $myform;
                 $this->render('reset');
             }
         } else {
             //echo "error";die;
             $this->_redirect('login/reset');
         }
     } else {
         //echo "uu";die;
         $this->_redirect('login/reset');
     }
 }