コード例 #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->getAdmin($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
 private function getAppMap()
 {
     $auth = Zing_Admin_Auth::getInstance();
     $adminflg = $auth->getIdentity()->adminflg;
     //var_dump($adminflg);die();
     $appserver = new AppInfo();
     $modelUser = new AdminReportHandler();
     $appIDs = $modelUser->getAdminApp($this->getUserID());
     $appMap = array();
     foreach ($appIDs as $appID) {
         if ($appID['adminAppID'] == 'credits_report') {
             $this->view->app_credits_report = 1;
             continue;
         }
         $appName = $appserver->getAppName($appID['adminAppID']);
         $appMap[$appID['adminAppID']] = $appName;
     }
     if ($adminflg == '1') {
         $appserver = new AppInfo();
         $allApp = $appserver->getAllAppInfo();
         foreach ($allApp as $appInfo) {
             $appMap['' . $appInfo->appID] = $appInfo->appName;
         }
     }
     if ($adminflg == '2') {
         $appserver = new AppInfo();
         $allApp = $appserver->getAllAppInfo();
         foreach ($allApp as $appInfo) {
             if ($appInfo->appID == 'admin' || $appInfo->appID == 'zing') {
                 continue;
             }
             $appMap['' . $appInfo->appID] = $appInfo->appName;
         }
     }
     return $appMap;
 }
コード例 #4
0
ファイル: AppController.php プロジェクト: utcuong3010/vng
 public function adminresetpassAction()
 {
     $array_of_params = $this->_request->getParams();
     if ($array_of_params["userId"] != "") {
         $adminReportHandler = new AdminReportHandler();
         $adminReportHandler->resetCreditspass($this->defaultPass, $array_of_params["userId"]);
     }
     die;
 }