Esempio n. 1
0
     // Actualizar cuenta
     if ($Account->updateAccount()) {
         if (is_array($customFields)) {
             foreach ($customFields as $id => $value) {
                 $CustomFields = new \SP\CustomFields($id, $accountId, $value);
                 $CustomFields->updateCustomField();
             }
         }
         SP\Response::printJSON(_('Cuenta actualizada'), 0);
     }
     SP\Response::printJSON(_('Error al modificar la cuenta'));
     break;
 case \SP\Controller\ActionsInterface::ACTION_ACC_DELETE:
     $Account->setAccountId($accountId);
     // Eliminar cuenta
     if ($Account->deleteAccount() && \SP\CustomFields::deleteCustomFieldForItem($accountId, \SP\Controller\ActionsInterface::ACTION_ACC_NEW)) {
         SP\Response::printJSON(_('Cuenta eliminada'), 0, "sysPassUtil.Common.doAction('" . \SP\Controller\ActionsInterface::ACTION_ACC_SEARCH . "');");
     }
     SP\Response::printJSON(_('Error al eliminar la cuenta'));
     break;
 case \SP\Controller\ActionsInterface::ACTION_ACC_EDIT_PASS:
     $Account->setAccountId($accountId);
     $Account->setAccountPass($accountEncPass['data']);
     $Account->setAccountIV($accountEncPass['iv']);
     $Account->setAccountUserEditId($currentUserId);
     // Actualizar clave de cuenta
     if ($Account->updateAccountPass()) {
         SP\Response::printJSON(_('Clave actualizada'), 0);
     }
     SP\Response::printJSON(_('Error al actualizar la clave'));
     break;
Esempio n. 2
0
 /**
  * Obtener la lista de campos personalizados y sus valores
  */
 private function getCustomFieldsForItem()
 {
     // Se comprueba que hayan campos con valores para el elemento actual
     if (!$this->view->isView && CustomFields::checkCustomFieldExists($this->_module, $this->view->itemId)) {
         $this->view->assign('customFields', CustomFields::getCustomFieldsData($this->_module, $this->view->itemId));
     } else {
         $this->view->assign('customFields', CustomFields::getCustomFieldsForModule($this->_module));
     }
 }
Esempio n. 3
0
 /**
  * Obtener la lista de campos personalizados y sus valores
  */
 private function getCustomFieldsForItem()
 {
     // Establecer el id de la cuenta en activo y no del historial
     $id = Session::getLastAcountId() !== 0 ? Session::getLastAcountId() : $this->getId();
     // Se comprueba que hayan campos con valores para la cuenta actual
     if ($this->isGotData() && CustomFields::checkCustomFieldExists(ActionsInterface::ACTION_ACC_NEW, $id)) {
         $this->view->assign('customFields', CustomFields::getCustomFieldsData(ActionsInterface::ACTION_ACC_NEW, $id));
     } else {
         $this->view->assign('customFields', CustomFields::getCustomFieldsForModule(ActionsInterface::ACTION_ACC_NEW));
     }
 }
Esempio n. 4
0
 } elseif ($newMasterPass != $newMasterPassR) {
     SP\Response::printJSON(_('Las claves maestras no coinciden'));
 } elseif (!SP\Crypt::checkHashPass($currentMasterPass, ConfigDB::getValue('masterPwd'), true)) {
     SP\Response::printJSON(_('La clave maestra actual no coincide'));
 }
 $hashMPass = SP\Crypt::mkHashPassword($newMasterPass);
 if (!$noAccountPassChange) {
     $Account = new SP\Account();
     if (!$Account->updateAccountsMasterPass($currentMasterPass, $newMasterPass)) {
         SP\Response::printJSON(_('Errores al actualizar las claves de las cuentas'));
     }
     $AccountHistory = new SP\AccountHistory();
     if (!$AccountHistory->updateAccountsMasterPass($currentMasterPass, $newMasterPass, $hashMPass)) {
         SP\Response::printJSON(_('Errores al actualizar las claves de las cuentas del histórico'));
     }
     if (!\SP\CustomFields::updateCustomFieldsCrypt($currentMasterPass, $newMasterPass)) {
         SP\Response::printJSON(_('Errores al actualizar datos de campos personalizados'));
     }
 }
 if (SP\Util::demoIsEnabled()) {
     SP\Response::printJSON(_('Ey, esto es una DEMO!!'));
 }
 //    ConfigDB::readConfig();
 ConfigDB::setCacheConfigValue('masterPwd', $hashMPass);
 ConfigDB::setCacheConfigValue('lastupdatempass', time());
 if (ConfigDB::writeConfig()) {
     SP\Log::writeNewLogAndEmail(_('Actualizar Clave Maestra'));
     SP\Response::printJSON(_('Clave maestra actualizada'), 0);
 } else {
     SP\Response::printJSON(_('Error al guardar el hash de la clave maestra'));
 }