public function indexAction()
 {
     global $mySession;
     $db = new Db();
     $adminData = $db->runQuery("select * from administrator where admin_id='1'");
     $this->view->adminData = $adminData[0];
     $myform = new Form_Changepassword();
     if ($this->getRequest()->isPost()) {
         $request = $this->getRequest();
         if ($myform->isValid($request->getPost())) {
             $dataForm = $myform->getValues();
             if ($dataForm['new_password'] != $dataForm['confirm_new_password']) {
                 $mySession->errorMsg = "New Password and Confirm new password Should be same.";
             } else {
                 $data_update['admin_password'] = md5($dataForm['new_password']);
                 $condition = "admin_id='" . $adminData[0]['admin_id'] . "'";
                 $db->modify('administrator', $data_update, $condition);
                 $mySession->sucessMsg = "Password changed successfully.";
             }
         }
     }
     $this->view->myform = $myform;
 }
 public function updatepassAction()
 {
     global $mySession;
     $db = new Db();
     $adminData = $db->runQuery("select * from " . ADMINISTRATOR . " where admin_id=" . $mySession->adminId . " ");
     $this->view->adminData = $adminData[0];
     if ($this->getRequest()->isPost()) {
         $request = $this->getRequest();
         $myform = new Form_Changepassword();
         if ($myform->isValid($request->getPost())) {
             if (TEESHIRTSCRIPT_ON_DEMO) {
                 $mySession->errorMsg = "You cannot change the password on the demo!";
                 $this->view->myform = $myform;
                 $this->render('index');
             } else {
                 $dataForm = $myform->getValues();
                 if ($dataForm['new_password'] != $dataForm['confirm_new_password']) {
                     $mySession->errorMsg = "New Password and Confirm new password Should be same.";
                     $this->view->myform = $myform;
                     $this->render('index');
                 } else {
                     $data_update['admin_password'] = md5($dataForm['new_password']);
                     $condition = "admin_id='" . $adminData[0]['admin_id'] . "'";
                     $db->modify('administrator', $data_update, $condition);
                     $mySession->errorMsg = "Password changed successfully.";
                     $this->_redirect('changepassword/index');
                 }
             }
         } else {
             $this->view->myform = $myform;
             $this->render('index');
         }
     } else {
         $this->_redirect('changepassword/index');
     }
 }
Example #3
0
 public function changepasswordAction()
 {
     global $mySession;
     $db = new Db();
     $this->view->pageHeading = "Change Password";
     $uType = $this->getRequest()->getParam('uType');
     $this->view->uType = $uType;
     $userId = $this->getRequest()->getParam('userId');
     $condition1 = " where user_id='" . $userId . "'";
     $qry = "select * from " . USERS . $condition1;
     $ResData = $db->runQuery("{$qry} ");
     $this->view->email = $ResData[0]['email_address'];
     $myform = new Form_Changepassword();
     $this->view->myform = $myform;
     if ($this->getRequest()->isPost()) {
         $request = $this->getRequest();
         if ($myform->isValid($request->getPost())) {
             $dataForm = $myform->getValues();
             if ($dataForm['new_password'] != $dataForm['confirm_new_password']) {
                 $mySession->errorMsg = "New Password And Confirm Password Does Not Match !";
             } else {
                 $data_update['password'] = md5($dataForm['new_password']);
                 $condition = "user_id='" . $userId . "'";
                 $db->modify(USERS, $data_update, $condition);
                 $mySession->sucessMsg = "Password changed successfully.";
             }
         }
     }
 }
 public function updatechangepasswordAction()
 {
     global $mySession;
     $db = new Db();
     $this->_helper->layout->setLayout('myaccount');
     $myform = new Form_Changepassword();
     $this->view->myform = $myform;
     if ($this->getRequest()->isPost()) {
         $request = $this->getRequest();
         $myform = new Form_Changepassword();
         if ($myform->isValid($request->getPost())) {
             $dataForm = $myform->getValues();
             $qury = $db->runquery("Select * from " . USERS . "");
             //$password=$qury[0]['password'];
             if ($dataForm['currentpass'] == $qury[0]['password']) {
                 $pass = $dataForm['newpass'];
                 $cnfrm = $dataForm['cnfrmnewpass'];
                 if ($pass == $cnfrm) {
                     $myObj = new Myaccountdb();
                     // call to model
                     $data = $myObj->changepass($dataForm);
                     if ($data == 1) {
                         $mySession->errorMsg = "Password updated successfully";
                         $this->_redirect('myaccount/changepassword');
                     }
                 } else {
                     $mySession->errorMsg = "password is not same";
                     $this->render('changepassword');
                 }
             } else {
                 $mySession->errorMsg = "Your Current Password does not match";
                 $this->render('changepassword');
             }
         } else {
             $this->view->myform = $myform;
             $this->render('changepassword');
         }
     } else {
         $this->_redirect('myaccount/changepassword');
     }
 }