Ejemplo n.º 1
0
 private function changePassword()
 {
     $this->load->file('application/forms/app/login_change_password_form.php');
     $resAjax = new Response_Ajax();
     $oBus = new Response_Business();
     $frmChangePassword = new Form_App_Login_Change_Password(TRUE);
     try {
         if (!$frmChangePassword->isValid()) {
             throw new Exception('Complete Correctamente los campo');
         }
         $oBus = Business_App_Token::inactivarUserToken(Helper_Encrypt::decode($frmChangePassword->id_user), 'id_user');
         if (!$oBus->isSuccess()) {
             throw new Exception($oBus->message());
         }
         $oBus = Business_App_User::updatePassword(Helper_Encrypt::decode($frmChangePassword->id_user), $frmChangePassword->new_password);
         if (!$oBus->isSuccess()) {
             throw new Exception($oBus->message());
         }
         $resAjax->isSuccess(TRUE);
         $resAjax->message($oBus->message());
     } catch (Exception $ex) {
         $resAjax->isSuccess(FALSE);
         $resAjax->message($ex->getMessage());
         $resAjax->form('changePassword', $frmChangePassword->toArray());
     }
     echo $resAjax->toJsonEncode();
 }
Ejemplo n.º 2
0
 public static function decryptIdValue(&$value_id)
 {
     if (ENVIRONMENT == 'development') {
         return;
     }
     if (empty($value_id)) {
         return;
     }
     $encryption_key = Helper_App_Session::getEncryptionKey();
     $value_id = Helper_Encrypt::decryptId($value_id, $encryption_key);
     if (!is_numeric($value_id)) {
         exit('Violacion de seguridad');
     }
 }