Esempio n. 1
0
 private function check()
 {
     $this->load->file('application/modules/app/login/login_data.php');
     $resAjax = new Response_Ajax();
     $dataLogin = new Data_App_Login(TRUE);
     $dataLoginError = NULL;
     //Helper_Log::write($_SESSION);
     try {
         $id_company = Helper_Config::getCompanyId();
         if (!$dataLogin->isValid($dataLoginError)) {
             throw new Exception('Complete correctamente todos los campos 001');
         }
         if (ENVIRONMENT != 'development') {
             if (!Helper_Captcha::isValid($this->name_key, $dataLogin->security)) {
                 throw new Exception('Código de seguridad inválido.');
                 //throw new Exception('Complete correctamente todos los campos 002');
             }
         }
         $oBus = Business_App_User::login($dataLogin->username, $dataLogin->password);
         if (!$oBus->isSuccess()) {
             throw new Exception($oBus->message());
         }
         $data = $oBus->data();
         /* @var $eUser eUser */
         $eUser = $data['eUser'];
         Helper_App_Session::init($id_company, $eUser->id);
         //Helper_App_Session::buildData();
         /*$eSessionActivity = new eSessionActivity();
           $eSessionActivity->id_user = Helper_App_Session::getUserId();
           $eSessionActivity->inUse = 1;
           $eSessionActivity->last_activity = date('Y-m-d H:i:s');
           $eSessionActivity->session_id = Helper_App_Session::getSessionID();
           */
         //Helper_App_Activity::set($eSessionActivity);
         $resAjax->isSuccess(TRUE);
     } catch (Exception $ex) {
         $resAjax->isSuccess(FALSE);
         $resAjax->message($ex->getMessage());
         $resAjax->data('login_error', $dataLoginError->toArray());
     }
     echo $resAjax->toJsonEncode();
 }
Esempio n. 2
0
 public function image_captcha($rand = '')
 {
     unset($rand);
     Helper_Captcha::show($this->name_key);
 }