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); $log->addDescription(_('Cuenta') . ': ' . $accountData->customer_name . " / " . $accountData->name); $log->writeLog(); } //$accountPass = htmlspecialchars(trim($accountClearPass)); $useImage = intval(\SP\Util::accountPassToImageIsEnabled()); $data = array('title' => _('Clave de Cuenta'), 'acclogin' => $accountData->login, 'accpass' => !$useImage ? trim($accountClearPass) : \SP\ImageUtil::convertText($accountClearPass), 'useimage' => $useImage); SP\Response::printJSON($data, 0);