/** * Establecer las variables que contienen la información de la cuenta en una fecha concreta. * * @return bool */ private function setAccountDataHistory() { try { $this->setAccount(new AccountHistory()); $this->_account->setAccountId($this->getId()); $this->_account->setAccountParentId(\SP\Session::getAccountParentId()); $this->view->assign('accountId', $this->getId()); $this->view->assign('accountData', $this->getAccount()->getAccountData()); $this->view->assign('gotData', true); $this->setAccountDetails(); $this->setGotData(true); Session::setLastAcountId(\SP\Session::getAccountParentId()); } catch (SPException $e) { return false; } return true; }
use SP\Request; use SP\UserPass; use SP\UserUtil; define('APP_ROOT', '..'); require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php'; Request::checkReferer('POST'); if (!SP\Init::isLoggedIn()) { SP\Response::printJSON(_('La sesión no se ha iniciado o ha caducado'), 10); } $accountId = SP\Request::analyze('accountid', false); $isHistory = SP\Request::analyze('isHistory', false); if (!$accountId) { return; } $account = !$isHistory ? new SP\Account() : new SP\AccountHistory(); $account->setAccountParentId(\SP\Session::getAccountParentId()); $account->setAccountId($accountId); $accountData = $account->getAccountPassData(); if ($isHistory && !$account->checkAccountMPass()) { SP\Response::printJSON(_('La clave maestra no coincide')); } if (!SP\Acl::checkAccountAccess(SP\Acl::ACTION_ACC_VIEW_PASS, $account->getAccountDataForACL()) || !SP\Acl::checkUserAccess(SP\Acl::ACTION_ACC_VIEW_PASS)) { SP\Response::printJSON(_('No tiene permisos para acceder a esta cuenta')); } elseif (!UserPass::checkUserUpdateMPass()) { SP\Response::printJSON(_('Clave maestra actualizada') . '<br>' . _('Reinicie la sesión para cambiarla')); } $accountClearPass = SP\Crypt::getDecrypt($accountData->pass, $accountData->iv); if (!$isHistory) { $account->incrementDecryptCounter(); $log = new \SP\Log(_('Ver Clave')); $log->addDescription(_('ID') . ': ' . $accountId);