コード例 #1
0
ファイル: IndexController.php プロジェクト: utcuong3010/vng
 public function changepassAction()
 {
     if ($this->getRequest()->isPost()) {
         $currpassword = $this->_request->getPost('currpassword');
         $password = $this->_request->getPost('password');
         $confirmpassword = $this->_request->getPost('confirmpassword');
         $model_user = new AdminReportHandler();
         $auth = Zing_Admin_Auth::getInstance();
         $userId = $auth->getIdentity()->userid;
         try {
             if ($currpassword == '' || $password == '' || $confirmpassword == "") {
                 $result['error'][] = "Enter required fields!";
             } else {
                 if ($password != $confirmpassword) {
                     $result['error'][] = "Password and confirm password do not match";
                 } else {
                     $user = $model_user->getCreditsAdmin($userId, $currpassword);
                     if (count($user) != 1) {
                         $result['error'][] = "Current password is wrong";
                     } else {
                         $resultChangePass = $model_user->changePass($userId, $currpassword, $password);
                         $result['success'] = true;
                     }
                 }
             }
         } catch (Exception $e) {
             $result['error'][] = "Unknown error";
         }
         echo json_encode($result);
         die;
     } else {
         $this->view->container = $this->view->render("index/changepass.phtml");
     }
 }
コード例 #2
0
ファイル: Auth.php プロジェクト: utcuong3010/vng
 public function authenticate($username, $password)
 {
     $modelUser = new AdminReportHandler();
     $result = $modelUser->getCreditsAdmin($username, md5($password));
     if (count($result) == 1) {
         $result = $result[0];
         //Identity from DB is object
         $this->_identity = new stdClass();
         $this->_identity->userid = $result['adminID'];
         $this->_identity->username = $result['adminID'];
         $this->_identity->name = $result['adminName'];
         $storage = $this->getStorage();
         $zadmin_auth = $storage->create();
         $storage->write($this->_identity);
         Zing_Cookies::createCookies(self::COOKIE_ADMIN_AUTH_KEY, $zadmin_auth, 0);
         return true;
     }
     return false;
 }
コード例 #3
0
ファイル: AppController.php プロジェクト: utcuong3010/vng
 public function adminedituserAction()
 {
     try {
         $array_of_params = $this->_request->getParams();
         if (isset($array_of_params['validate'])) {
             $this->view->validate = $array_of_params['validate'];
         }
         $adminReportHandler = new AdminReportHandler();
         $admin = $adminReportHandler->getCreditsAdmin($array_of_params['userId']);
         $userData["txtUserName"] = $admin["adminID"];
         $userData["txtName"] = $admin["adminName"];
         $this->view->userData = $userData;
         $this->view->frmSearch = $this->view->render('index/creditsedituser.phtml');
         $this->view->container = $this->view->render('index/index.phtml');
     } catch (Exception $e) {
         var_dump($e);
         die;
     }
 }