Example #1
0
        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;
    case \SP\Controller\ActionsInterface::ACTION_ACC_EDIT_RESTORE:
        $Account->setAccountId(SP\AccountHistory::getAccountIdFromId($accountId));
        $Account->setAccountUserEditId($currentUserId);
        if ($Account->restoreFromHistory($accountId)) {
            SP\Response::printJSON(_('Cuenta restaurada'), 0);
        }
        SP\Response::printJSON(_('Error al restaurar cuenta'));
        break;
    default:
        SP\Response::printJSON(_('Acción Inválida'));
}
Example #2
0
     SP\Response::printJSON(_('Se ha de confirmar el cambio de clave'));
 }
 if ($newMasterPass == $currentMasterPass) {
     SP\Response::printJSON(_('Las claves son idénticas'));
 } 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'));