Merge remote-tracking branch 'origin/devel' into devel

Conflicts:
	inc/themes/material-blue/css/styles.min.css
	js/app-actions.min.js
	js/app-main.min.js
This commit is contained in:
nuxsmin
2016-12-20 11:00:13 +01:00
12 changed files with 457 additions and 295 deletions

Binary file not shown.

View File

@@ -27,12 +27,18 @@ namespace SP\Controller;
defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo'));
use SP\Account\Account;
use SP\Account\AccountHistory;
use SP\Api\ApiTokensUtil;
use SP\Core\Acl;
use SP\Core\ActionsInterface;
use SP\Core\Crypt;
use SP\Core\Exceptions\ItemException;
use SP\Core\Init;
use SP\Core\Session;
use SP\Core\SessionUtil;
use SP\Core\Template;
use SP\DataModel\AccountExtData;
use SP\DataModel\CategoryData;
use SP\DataModel\CustomerData;
use SP\DataModel\CustomFieldData;
@@ -41,7 +47,6 @@ use SP\DataModel\GroupData;
use SP\DataModel\ProfileData;
use SP\DataModel\TagData;
use SP\DataModel\UserData;
use SP\Http\JsonResponse;
use SP\Http\Request;
use SP\Log\Log;
use SP\Mgmt\Categories\Category;
@@ -51,14 +56,15 @@ use SP\Mgmt\CustomFields\CustomFieldDef;
use SP\Mgmt\CustomFields\CustomFieldTypes;
use SP\Mgmt\Files\FileUtil;
use SP\Mgmt\Groups\GroupUsers;
use SP\Mgmt\ItemSelectInterface;
use SP\Mgmt\PublicLinks\PublicLink;
use SP\Mgmt\Groups\Group;
use SP\Mgmt\Profiles\Profile;
use SP\Mgmt\Profiles\ProfileUtil;
use SP\Mgmt\Tags\Tag;
use SP\Mgmt\Users\User;
use SP\Mgmt\Users\UserPass;
use SP\Util\Checks;
use SP\Util\ImageUtil;
use SP\Util\Json;
use SP\Util\Util;
@@ -224,11 +230,17 @@ class ItemShowController extends ControllerBase implements ActionsInterface, Ite
$this->view->assign('header', _('Editar Etiqueta'));
$this->getTag();
break;
case self::ACTION_ACC_VIEW_PASS:
$this->view->assign('header', _('Clave de Cuenta'));
$this->getAccountPass();
break;
default:
$this->invalidAction();
}
$this->jsonResponse->setData(['html' => $this->render()]);
if (count($this->jsonResponse->getData()) === 0) {
$this->jsonResponse->setData(['html' => $this->render()]);
}
} catch (\Exception $e) {
$this->jsonResponse->setDescription($e->getMessage());
}
@@ -241,7 +253,7 @@ class ItemShowController extends ControllerBase implements ActionsInterface, Ite
*
* @throws \SP\Core\Exceptions\SPException
*/
public function getUser()
protected function getUser()
{
$this->module = self::ACTION_USR_USERS;
$this->view->addTemplate('users');
@@ -260,7 +272,7 @@ class ItemShowController extends ControllerBase implements ActionsInterface, Ite
/**
* Obtener la lista de campos personalizados y sus valores
*/
private function getCustomFieldsForItem()
protected function getCustomFieldsForItem()
{
$this->view->assign('customFields', CustomField::getItem(new CustomFieldData($this->module))->getById($this->itemId));
}
@@ -268,7 +280,7 @@ class ItemShowController extends ControllerBase implements ActionsInterface, Ite
/**
* Inicializar la vista de cambio de clave de usuario
*/
public function getUserPass()
protected function getUserPass()
{
$this->module = self::ACTION_USR_USERS;
$this->setAction(self::ACTION_USR_USERS_EDITPASS);
@@ -287,7 +299,7 @@ class ItemShowController extends ControllerBase implements ActionsInterface, Ite
/**
* Obtener los datos para la ficha de grupo
*/
public function getGroup()
protected function getGroup()
{
$this->module = self::ACTION_USR_GROUPS;
$this->view->addTemplate('groups');
@@ -304,7 +316,7 @@ class ItemShowController extends ControllerBase implements ActionsInterface, Ite
/**
* Obtener los datos para la ficha de perfil
*/
public function getProfile()
protected function getProfile()
{
$this->module = self::ACTION_USR_PROFILES;
$this->view->addTemplate('profiles');
@@ -325,7 +337,7 @@ class ItemShowController extends ControllerBase implements ActionsInterface, Ite
/**
* Obtener los datos para la ficha de cliente
*/
public function getCustomer()
protected function getCustomer()
{
$this->module = self::ACTION_MGM_CUSTOMERS;
$this->view->addTemplate('customers');
@@ -339,7 +351,7 @@ class ItemShowController extends ControllerBase implements ActionsInterface, Ite
/**
* Obtener los datos para la ficha de categoría
*/
public function getCategory()
protected function getCategory()
{
$this->module = self::ACTION_MGM_CATEGORIES;
$this->view->addTemplate('categories');
@@ -353,7 +365,7 @@ class ItemShowController extends ControllerBase implements ActionsInterface, Ite
/**
* Obtener los datos para la ficha de tokens de API
*/
public function getToken()
protected function getToken()
{
$this->module = self::ACTION_MGM_APITOKENS;
$this->view->addTemplate('tokens');
@@ -376,7 +388,7 @@ class ItemShowController extends ControllerBase implements ActionsInterface, Ite
/**
* Obtener los datos para la ficha de campo personalizado
*/
public function getCustomField()
protected function getCustomField()
{
$this->module = self::ACTION_MGM_CUSTOMFIELDS;
$this->view->addTemplate('customfields');
@@ -396,7 +408,7 @@ class ItemShowController extends ControllerBase implements ActionsInterface, Ite
*
* @throws \SP\Core\Exceptions\SPException
*/
public function getPublicLink()
protected function getPublicLink()
{
$this->module = self::ACTION_MGM_PUBLICLINKS;
$this->view->addTemplate('publiclinks');
@@ -413,7 +425,7 @@ class ItemShowController extends ControllerBase implements ActionsInterface, Ite
*
* @throws \SP\Core\Exceptions\SPException
*/
public function getTag()
protected function getTag()
{
$this->module = self::ACTION_MGM_TAGS;
$this->view->addTemplate('tags');
@@ -426,7 +438,7 @@ class ItemShowController extends ControllerBase implements ActionsInterface, Ite
/**
* Obtener los datos para la vista de archivos de una cuenta
*/
public function getAccountFiles()
protected function getAccountFiles()
{
$this->setAction(self::ACTION_ACC_FILES);
@@ -442,4 +454,82 @@ class ItemShowController extends ControllerBase implements ActionsInterface, Ite
$this->jsonResponse->setStatus(0);
}
/**
* Mostrar la clave de una cuenta
*
* @throws ItemException
*/
public function getAccountPass()
{
$this->setAction(self::ACTION_ACC_VIEW_PASS);
$isHistory = Request::analyze('isHistory', false);
$isFull = Request::analyze('isFull', false);
$AccountData = new AccountExtData();
if (!$isHistory) {
$AccountData->setAccountId($this->itemId);
$Account = new Account($AccountData);
} else {
$Account = new AccountHistory($AccountData);
$Account->setId($this->itemId);
}
$Account->getAccountPassData();
if ($isHistory && !$Account->checkAccountMPass()) {
throw new ItemException(_('La clave maestra no coincide'));
}
$Acl = new Acl(Acl::ACTION_ACC_VIEW_PASS);
$Acl->setAccountData($Account->getAccountDataForACL());
if (!Acl::checkUserAccess(Acl::ACTION_ACC_VIEW_PASS) || !$Acl->checkAccountAccess()) {
throw new ItemException(_('No tiene permisos para acceder a esta cuenta'));
} elseif (!UserPass::checkUserUpdateMPass(Session::getUserData()->getUserId())) {
throw new ItemException(_('Clave maestra actualizada') . '<br>' . _('Reinicie la sesión para cambiarla'));
}
$accountClearPass = Crypt::getDecrypt($AccountData->getAccountPass(), $AccountData->getAccountIV());
if (!$isHistory) {
$Account->incrementDecryptCounter();
$log = new Log(_('Ver Clave'));
$log->addDetails(_('ID'), $this->itemId);
$log->addDetails(_('Cuenta'), $AccountData->getCustomerName() . ' / ' . $AccountData->getAccountName());
$log->writeLog();
}
$useImage = (int)Checks::accountPassToImageIsEnabled();
if (!$useImage) {
$pass = $isFull ? htmlentities(trim($accountClearPass)) : trim($accountClearPass);
} else {
$pass = ImageUtil::convertText($accountClearPass);
}
$this->jsonResponse->setStatus(0);
if ($isFull) {
$this->view->addTemplate('viewpass', 'account');
$this->view->assign('login', $AccountData->getAccountLogin());
$this->view->assign('pass', $pass);
$this->view->assign('isImage', $useImage);
return;
}
$data = [
'acclogin' => $AccountData->getAccountLogin(),
'accpass' => $pass,
'useimage' => $useImage
];
$this->jsonResponse->setCsrf($this->view->sk);
$this->jsonResponse->setData($data);
}
}

View File

@@ -0,0 +1,36 @@
<?php
/**
* sysPass
*
* @author nuxsmin
* @link http://syspass.org
* @copyright 2012-2016, Rubén Domínguez nuxsmin@$syspass.org
*
* This file is part of sysPass.
*
* sysPass is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* sysPass is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
*/
namespace SP\Core\Exceptions;
/**
* Class ItemException
*
* @package SP\Core\Exceptions
*/
class ItemException extends \Exception
{
}

View File

@@ -65,7 +65,7 @@ class ImageUtil
imagefilledrectangle($im, 0, 0, strlen($text) * 20, 29, $bgColor);
// Ruta de la fuente
$font = Init::$SERVERROOT . '/imgs/NotoSansUI-Regular.ttf';
$font = Init::$SERVERROOT . '/css/fonts/NotoSans-Regular-webfont.ttf';
// Sombra
// imagettftext($im, 14, 0, 13, 23, $shadowColor, $font, $text);

View File

@@ -263,7 +263,8 @@ pre, code, samp, kbd {
margin: 0
}
#content td.descField, #fancyContainer td.descField {
#content td.descField,
#fancyContainer td.descField {
text-align: right;
padding-right: 20px;
width: 25%;
@@ -921,12 +922,41 @@ pre, code, samp, kbd {
}
#fancyContainer {
width: auto;
min-width: 25em;
max-width: 50em;
margin: 5em auto;
padding: 0;
background-color: #fff;
border-radius: 5px;
}
#fancyContainer > h2 {
width: 100%;
font-size: 18px;
color: white;
background-color: #607d8b;
margin: 0 0 1em 0;
padding: .5em 0;
line-height: 1em;
}
#fancyContainer > table {
width: 100%;
padding-bottom: 1em;
}
#fancyContainer select {
width: 220px
}
#fancyContainer #resFancyAccion {
display: none
}
#fancyContainer #resCheck {
display: inline-block;
width: 80%;
height: 4em;
padding: 1em 0
}
#fancyContainer.image {
@@ -947,20 +977,6 @@ pre, code, samp, kbd {
padding: .5em;
}
#fancyContainer > h2 {
width: 100%;
font-size: 18px;
color: white;
background-color: #607d8b;
margin: 0 0 1em 0;
padding: .5em 0;
line-height: 1em;
}
#fancyContainer select {
width: 220px
}
#fancyContainer.help {
min-height: 100px;
background-color: #f5f5f5
@@ -972,17 +988,6 @@ pre, code, samp, kbd {
line-height: 2em
}
#fancyContainer #resFancyAccion {
display: none
}
#fancyContainer #resCheck {
display: inline-block;
width: 80%;
height: 4em;
padding: 1em 0
}
#debug {
float: left;
text-align: left
@@ -1365,10 +1370,9 @@ footer img {
line-height: 2.5em
}
.dialog-clip-pass-copy {
.dialog-clip-copy {
background-color: #ecfde4;
color: green;
border: #dbfdcb 1px solid
}
.help-box {
@@ -1665,6 +1669,18 @@ fieldset.warning a {
display: none;
}
.center {
text-align: center !important;
}
.right {
text-align: right !important;
}
.left {
text-align: left !important;
}
@media screen and (max-width: 1000px) {
#content #searchbox {
position: relative;

View File

@@ -1,113 +1,119 @@
<?php /** @var $icons \Theme\Icons */ ?>
<div id="title" class="midroundup titleNormal">
<?php echo $title['name']; ?>
<i id="history-icon" class="material-icons"><?php echo $title['icon']; ?></i>
</div>
<form method="post" name="editpass" id="frmEditPass" class="form-action" data-onsubmit="account/save" data-hash="">
<table class="data round">
<tr>
<td class="descField"><?php echo _('Nombre'); ?></td>
<td class="valField">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input id="name" name="name" type="text"
class="mdl-textfield__input mdl-color-text--indigo-400"
value="<?php echo $accountData->getAccountName(); ?>" readonly>
<label class="mdl-textfield__label" for="name"><?php echo _('Nombre de cuenta'); ?></label>
</div>
</td>
</tr>
<tr>
<td class="descField"><?php echo _('Cliente'); ?></td>
<td class="valField">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input id="customer" name="customer" type="text"
class="mdl-textfield__input mdl-color-text--indigo-400"
value="<?php echo $accountData->getCustomerName(); ?>" readonly>
<label class="mdl-textfield__label" for="customer"><?php echo _('Cliente'); ?></label>
</div>
</td>
</tr>
<tr>
<td class="descField"><?php echo _('URL / IP'); ?></td>
<td class="valField">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input id="url" name="url" type="text"
class="mdl-textfield__input mdl-color-text--indigo-400"
value="<?php echo $accountData->getAccountUrl(); ?>" readonly>
<label class="mdl-textfield__label" for="url"><?php echo _('URL / IP'); ?></label>
</div>
</td>
</tr>
<tr>
<td class="descField"><?php echo _('Usuario'); ?></td>
<td class="valField">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input id="user" name="user" type="text"
class="mdl-textfield__input mdl-color-text--indigo-400"
value="<?php echo $accountData->getAccountLogin(); ?>" readonly>
<label class="mdl-textfield__label" for="user"><?php echo _('Usuario'); ?></label>
</div>
</td>
</tr>
<tr>
<td class="descField"><?php echo _('Clave'); ?></td>
<td class="valField">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input id="accountpass" name="pass" type="password" required
class="mdl-textfield__input mdl-color-text--indigo-400 passwordfield__input"
maxlength="255" autocomplete="off">
<label class="mdl-textfield__label" for="accountpass"><?php echo _('Clave'); ?></label>
</div>
</td>
</tr>
<tr>
<td class="descField"><?php echo _('Clave (repetir)'); ?></td>
<td class="valField">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input id="accountpassR" name="passR" type="password" required
class="mdl-textfield__input mdl-color-text--indigo-400"
maxlength="255" autocomplete="off">
<label class="mdl-textfield__label" for="accountpassR"><?php echo _('Clave'); ?></label>
</div>
</td>
</tr>
<tr>
<td class="descField"><?php echo _('Fecha Caducidad Clave'); ?></td>
<td class="valField">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input id="accountpassdatechange" name="accountpassdatechange" type="date"
class="mdl-textfield__input mdl-color-text--indigo-400 password-datefield__input"
value="<?php echo $accountPassDateChange; ?>">
<label class="mdl-textfield__label"
for="accountpassdatechange"><?php echo _('Fecha'); ?></label>
</div>
<i class="material-icons btn-action"
title="<?php echo _('Seleccionar Fecha'); ?>">date_range</i>
</td>
</tr>
</table>
<input type="hidden" name="actionId" value="<?php echo $actionId; ?>"/>
<input type="hidden" name="itemId" value="<?php echo $accountId; ?>"/>
<input type="hidden" name="sk" value="">
<input type="hidden" name="isAjax" value="1">
<div class="action">
<button id="btnBack" type="button"
class="btn-back mdl-button mdl-js-button mdl-button--fab mdl-button--mini-fab mdl-button--colored <?php echo $icons->getIconBack()->getClassButton(); ?>"
title="<?php echo _('Atrás'); ?>">
<i class="material-icons"><?php echo $icons->getIconBack()->getIcon(); ?></i>
</button>
<button id="btnSave" name="btnSave" type="submit" form="frmEditPass"
class="mdl-button mdl-js-button mdl-button--fab mdl-button--mini-fab mdl-button--colored <?php echo $icons->getIconSave()->getClassButton(); ?>"
title="<?php echo _('Guardar'); ?>">
<i class="material-icons"><?php echo $icons->getIconSave()->getIcon(); ?></i>
</button>
<div class="data-container">
<div id="title" class="midroundup titleNormal">
<?php echo $title['name']; ?>
<i id="history-icon" class="material-icons"><?php echo $title['icon']; ?></i>
</div>
</form>
<form method="post" name="editpass" id="frmEditPass" class="form-action" data-onsubmit="account/save" data-hash="">
<table class="data round">
<tr>
<td class="descField"><?php echo _('Nombre'); ?></td>
<td class="valField">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input id="name" name="name" type="text"
class="mdl-textfield__input mdl-color-text--indigo-400"
value="<?php echo $accountData->getAccountName(); ?>" readonly>
<label class="mdl-textfield__label" for="name"><?php echo _('Nombre de cuenta'); ?></label>
</div>
</td>
</tr>
<tr>
<td class="descField"><?php echo _('Cliente'); ?></td>
<td class="valField">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input id="customer" name="customer" type="text"
class="mdl-textfield__input mdl-color-text--indigo-400"
value="<?php echo $accountData->getCustomerName(); ?>" readonly>
<label class="mdl-textfield__label" for="customer"><?php echo _('Cliente'); ?></label>
</div>
</td>
</tr>
<tr>
<td class="descField"><?php echo _('URL / IP'); ?></td>
<td class="valField">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input id="url" name="url" type="text"
class="mdl-textfield__input mdl-color-text--indigo-400"
value="<?php echo $accountData->getAccountUrl(); ?>" readonly>
<label class="mdl-textfield__label" for="url"><?php echo _('URL / IP'); ?></label>
</div>
</td>
</tr>
<tr>
<td class="descField"><?php echo _('Usuario'); ?></td>
<td class="valField">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input id="user" name="user" type="text"
class="mdl-textfield__input mdl-color-text--indigo-400"
value="<?php echo $accountData->getAccountLogin(); ?>" readonly>
<label class="mdl-textfield__label" for="user"><?php echo _('Usuario'); ?></label>
</div>
</td>
</tr>
<tr>
<td class="descField"><?php echo _('Clave'); ?></td>
<td class="valField">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input id="accountpass" name="pass" type="password" required
class="mdl-textfield__input mdl-color-text--indigo-400 passwordfield__input"
maxlength="255" autocomplete="off">
<label class="mdl-textfield__label" for="accountpass"><?php echo _('Clave'); ?></label>
</div>
</td>
</tr>
<tr>
<td class="descField"><?php echo _('Clave (repetir)'); ?></td>
<td class="valField">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input id="accountpassR" name="passR" type="password" required
class="mdl-textfield__input mdl-color-text--indigo-400"
maxlength="255" autocomplete="off">
<label class="mdl-textfield__label" for="accountpassR"><?php echo _('Clave'); ?></label>
</div>
</td>
</tr>
<tr>
<td class="descField"><?php echo _('Fecha Caducidad Clave'); ?></td>
<td class="valField">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input id="accountpassdatechange" name="accountpassdatechange" type="date"
class="mdl-textfield__input mdl-color-text--indigo-400 password-datefield__input"
value="<?php echo $accountPassDateChange; ?>">
<label class="mdl-textfield__label"
for="accountpassdatechange"><?php echo _('Fecha'); ?></label>
</div>
<i class="material-icons btn-action"
title="<?php echo _('Seleccionar Fecha'); ?>">date_range</i>
</td>
</tr>
</table>
<input type="hidden" name="actionId" value="<?php echo $actionId; ?>"/>
<input type="hidden" name="itemId" value="<?php echo $accountId; ?>"/>
<input type="hidden" name="sk" value="">
<input type="hidden" name="isAjax" value="1">
<div class="item-actions">
<ul>
<li>
<button id="btnBack" type="button"
class="btn-back mdl-button mdl-js-button mdl-button--fab mdl-button--mini-fab mdl-button--colored <?php echo $icons->getIconBack()->getClassButton(); ?>"
title="<?php echo _('Atrás'); ?>">
<i class="material-icons"><?php echo $icons->getIconBack()->getIcon(); ?></i>
</button>
</li>
<li>
<button id="btnSave" name="btnSave" type="submit" form="frmEditPass"
class="mdl-button mdl-js-button mdl-button--fab mdl-button--mini-fab mdl-button--colored <?php echo $icons->getIconSave()->getClassButton(); ?>"
title="<?php echo _('Guardar'); ?>">
<i class="material-icons"><?php echo $icons->getIconSave()->getIcon(); ?></i>
</button>
</li>
</ul>
</div>
</form>
</div>
<script>
sysPassApp.sk.set("<?php echo $sk; ?>");

View File

@@ -51,19 +51,23 @@
</tr>
</table>
<div class="action">
<?php if (!$useImage): ?>
<button id="btnClipPass"
class="btn-action mdl-button mdl-js-button mdl-button--fab mdl-button--mini-fab mdl-button--colored mdl-color--indigo-A200"
data-clipboard-target="#account-pass"
data-action-id="<?php echo \SP\Core\ActionsInterface::ACTION_ACC_VIEW_PASS; ?>"
data-item-id="<?php echo $accountId; ?>"
data-sk="<?php echo $sk; ?>"
data-history="0"
data-onclick="account/copypass">
<i class="material-icons">content_paste</i>
</button>
<?php endif; ?>
<div class="item-actions">
<ul>
<?php if (!$useImage): ?>
<li>
<button id="btnClipPass"
class="btn-action mdl-button mdl-js-button mdl-button--fab mdl-button--mini-fab mdl-button--colored mdl-color--indigo-A200"
data-clipboard-target="#account-pass"
data-action-id="<?php echo \SP\Core\ActionsInterface::ACTION_ACC_VIEW_PASS; ?>"
data-item-id="<?php echo $accountId; ?>"
data-sk="<?php echo $sk; ?>"
data-history="0"
data-onclick="account/copypass">
<i class="material-icons">content_paste</i>
</button>
</li>
<?php endif; ?>
</ul>
</div>
</div>
</div>

View File

@@ -1,63 +1,65 @@
<?php /** @var $icons \Theme\Icons */ ?>
<div id="title" class="midroundup titleNormal"><?php echo _('Solicitar Modificación de Cuenta'); ?></div>
<div class="data-container">
<div id="title" class="midroundup titleNormal"><?php echo _('Solicitar Modificación de Cuenta'); ?></div>
<form method="post" name="requestmodify" id="frmRequestModify"
class="form-action"
data-hash=""
data-onsubmit="account/request">
<table class="data round">
<tr>
<td class="descField"><?php echo _('Nombre'); ?></td>
<td class="valField"><?php echo $accountData->getAccountName(); ?></td>
</tr>
<tr>
<td class="descField"><?php echo _('Cliente'); ?></td>
<td class="valField"><?php echo $accountData->customer_name; ?></td>
</tr>
<?php if ($lastAction === \SP\Core\ActionsInterface::ACTION_ACC_SEARCH): ?>
<form method="post" name="requestmodify" id="frmRequestModify"
class="form-action"
data-hash=""
data-onsubmit="account/request">
<table class="data round">
<tr>
<td class="descField"><?php echo _('URL / IP'); ?></td>
<td class="valField"><A href="<?php echo $accountData->getAccountUrl(); ?>"
target="_blank"><?php echo $accountData->getAccountUrl(); ?></td>
<td class="descField"><?php echo _('Nombre'); ?></td>
<td class="valField"><?php echo $accountData->getAccountName(); ?></td>
</tr>
<tr>
<td class="descField"><?php echo _('Usuario'); ?></td>
<td class="valField"><?php echo $accountData->getAccountLogin(); ?></td>
<td class="descField"><?php echo _('Cliente'); ?></td>
<td class="valField"><?php echo $accountData->customer_name; ?></td>
</tr>
<?php endif; ?>
<tr>
<td class="descField"><?php echo _('Petición'); ?></td>
<td class="valField">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<?php if ($lastAction === \SP\Core\ActionsInterface::ACTION_ACC_SEARCH): ?>
<tr>
<td class="descField"><?php echo _('URL / IP'); ?></td>
<td class="valField"><A href="<?php echo $accountData->getAccountUrl(); ?>"
target="_blank"><?php echo $accountData->getAccountUrl(); ?></td>
</tr>
<tr>
<td class="descField"><?php echo _('Usuario'); ?></td>
<td class="valField"><?php echo $accountData->getAccountLogin(); ?></td>
</tr>
<?php endif; ?>
<tr>
<td class="descField"><?php echo _('Petición'); ?></td>
<td class="valField">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<textarea class="mdl-textfield__input mdl-color-text--indigo-400" rows="3" id="description"
name="description" maxlength="1000"></textarea>
<label class="mdl-textfield__label"
for="description"><?php echo _('Descripción de la petición'); ?></label>
</div>
</td>
</tr>
</table>
<input type="hidden" name="accountid" value="<?php echo $accountId; ?>"/>
<input type="hidden" name="sk" value="<?php echo $sk; ?>">
<input type="hidden" name="isAjax" value="1">
</form>
<label class="mdl-textfield__label"
for="description"><?php echo _('Descripción de la petición'); ?></label>
</div>
</td>
</tr>
</table>
<input type="hidden" name="accountid" value="<?php echo $accountId; ?>"/>
<input type="hidden" name="sk" value="<?php echo $sk; ?>">
<input type="hidden" name="isAjax" value="1">
</form>
<div class="item-actions">
<ul>
<li>
<button id="btnBack" type="button"
class="mdl-button mdl-js-button mdl-button--fab mdl-button--mini-fab mdl-button--colored <?php echo $icons->getIconBack()->getClassButton(); ?>"
title="<?php echo $icons->getIconBack()->getTitle(); ?>">
<i class="material-icons"><?php echo $icons->getIconBack()->getIcon(); ?></i>
</button>
</li>
<li>
<button id="btnSave" form="frmRequestModify"
class="mdl-button mdl-js-button mdl-button--fab mdl-button--mini-fab mdl-button--colored <?php echo $icons->getIconSave()->getClassButton(); ?>"
title="<?php echo _('Enviar'); ?>">
<i class="material-icons"><?php echo $icons->getIconSave()->getIcon(); ?></i>
</button>
</li>
</ul>
<div class="item-actions">
<ul>
<li>
<button id="btnBack" type="button"
class="mdl-button mdl-js-button mdl-button--fab mdl-button--mini-fab mdl-button--colored <?php echo $icons->getIconBack()->getClassButton(); ?>"
title="<?php echo $icons->getIconBack()->getTitle(); ?>">
<i class="material-icons"><?php echo $icons->getIconBack()->getIcon(); ?></i>
</button>
</li>
<li>
<button id="btnSave" form="frmRequestModify"
class="mdl-button mdl-js-button mdl-button--fab mdl-button--mini-fab mdl-button--colored <?php echo $icons->getIconSave()->getClassButton(); ?>"
title="<?php echo _('Enviar'); ?>">
<i class="material-icons"><?php echo $icons->getIconSave()->getIcon(); ?></i>
</button>
</li>
</ul>
</div>
</div>

View File

@@ -0,0 +1,41 @@
<?php
/** @var \SP\DataModel\CategoryData $category */
/** @var \SP\Core\UI\ThemeIconsBase $icons */
?>
<div id="fancyContainer" align="center">
<h2><?php echo $header; ?></h2>
<table>
<tbody>
<tr>
<td class="dialog-user-text"><?php echo $login; ?></td>
<td class="right">
<button class="dialog-clip-user-button mdl-button mdl-js-button mdl-js-ripple-effect"
title="<?php echo _('Copiar Usuario'); ?>" data-clipboard-target=".dialog-user-text">
<?php echo _('Usuario'); ?>
<i class="material-icons"><?php echo $icons->getIconClipboard()->getIcon(); ?></i>
</button>
</td>
</tr>
<tr>
<?php if (!$isImage): ?>
<td class="dialog-pass-text"><?php echo $pass; ?></td>
<td class="right">
<button class="dialog-clip-pass-button mdl-button mdl-js-button mdl-js-ripple-effect"
title="<?php echo _('Copiar Clave'); ?>" data-clipboard-target=".dialog-pass-text">
<?php echo _('Clave'); ?>
<i class="material-icons"><?php echo $icons->getIconClipboard()->getIcon(); ?></i>
</button>
</td>
<?php else: ?>
<td class="dialog-pass-text">
<img src="data:image/png;base64,<?php echo $pass; ?>"/>
</td>
<td>&nbsp;</td>
<?php endif; ?>
</tr>
</tbody>
</table>
</div>
<script>
sysPassApp.sk.set("<?php echo $sk; ?>");
</script>

View File

@@ -3,12 +3,11 @@
<div id="footer-left" class="footer-parts">
<?php if ($loggedIn === true): ?>
<div id="session">
<i id="btnLogout" class="material-icons" title="<?php echo _('Salir'); ?>">exit_to_app</i>
<i id="btnLogout" class="material-icons">exit_to_app</i>
<span for="btnLogout"
class="mdl-tooltip mdl-tooltip--top"><?php echo _('Salir'); ?></span>
<?php if ($showPassIcon): ?>
<i id="btnUserPass" class="btn-action material-icons"
title=""
<i id="btnUserPass" class="btn-action material-icons">
data-onclick="appMgmt/show"
data-action-id="<?php echo \SP\Core\ActionsInterface::ACTION_USR_USERS_EDITPASS; ?>"
data-item-id="<?php echo $userId; ?>"

View File

@@ -27,7 +27,7 @@ sysPass.Actions = function (Common) {
var log = Common.log;
// Variable para almacenar la llamada a setTimeout()
var timeout;
var timeout = 0;
// Atributos de la ordenación de búsquedas
var order = {key: 0, dir: 0};
@@ -186,6 +186,13 @@ sysPass.Actions = function (Common) {
});
};
/**
* Cerrar los diálogos
*/
var closeFloatingBox = function () {
$.magnificPopup.close();
};
/**
* Objeto con las acciones de usuario
*
@@ -684,101 +691,59 @@ sysPass.Actions = function (Common) {
log.info("account:showpass");
var opts = Common.appRequests().getRequestOpts();
opts.url = ajaxUrl.account.showPass;
opts.url = ajaxUrl.appMgmt.show;
opts.data = {
itemId: $obj.data("item-id"),
actionId: $obj.data("action-id"),
isHistory: $obj.data("history"),
isFull: $obj.data("full"),
isFull: 1,
sk: Common.sk.get(),
isAjax: 1
};
Common.appRequests().getActionCall(opts, function (json) {
if (json.status === 10) {
main.logout();
return;
}
if (json.status !== 0) {
Common.msg.out(json);
} else {
var $container = $(json.data.html);
var $dialog;
showFloatingBox($obj, $container);
$("<div></div>").dialog({
modal: true,
title: Common.config().LANG[47],
width: "auto",
open: function () {
$dialog = $(this);
var content;
var pass = "";
var clipboardUserButton =
"<button class=\"dialog-clip-user-button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-primary\" data-clipboard-target=\".dialog-user-text\">" +
"<span class=\"ui-button-icon-primary ui-icon ui-icon-clipboard\"></span>" +
"<span class=\"ui-button-text\">" + Common.config().LANG[33] + "</span>" +
"</button>";
var clipboardPassButton =
"<button class=\"dialog-clip-pass-button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-primary\" data-clipboard-target=\".dialog-pass-text\">" +
"<span class=\"ui-button-icon-primary ui-icon ui-icon-clipboard\"></span>" +
"<span class=\"ui-button-text\">" + Common.config().LANG[34] + "</span>" +
"</button>";
var useImage = json.useimage;
var user = "<p class=\"dialog-user-text\">" + json.acclogin + "</p>";
if (json.status === 0) {
if (useImage === 0) {
pass = "<p class=\"dialog-pass-text\">" + json.accpass + "</p>";
} else {
pass = "<img class=\"dialog-pass-text\" src=\"data:image/png;base64," + json.accpass + "\" />";
clipboardPassButton = "";
}
content = user + pass + "<div class=\"dialog-buttons\">" + clipboardUserButton + clipboardPassButton + "</div>";
} else {
content = "<span class=\"altTxtRed\">" + json.description + "</span>";
$dialog.dialog("option", "buttons",
[{
text: "Ok",
icons: {primary: "ui-icon-close"},
click: function () {
$dialog.dialog("close");
}
}]
);
}
$dialog.html(content);
// Recentrar después de insertar el contenido
$dialog.dialog("option", "position", "center");
// Cerrar Dialog a los 30s
$dialog.parent().on("mouseleave", function () {
clearTimeout(timeout);
timeout = setTimeout(function () {
$dialog.dialog("close");
}, 30000);
});
},
// Forzar la eliminación del objeto para que siga copiando al protapapeles al abrirlo de nuevo
close: function () {
$container.on("mouseleave", function () {
clearTimeout(timeout);
$dialog.dialog("destroy");
}
});
timeout = setTimeout(function () {
closeFloatingBox();
}, 30000);
}).on("mouseenter", function () {
if (timeout !== 0) {
clearTimeout(timeout);
}
});
}
});
},
copypass: function ($obj) {
log.info("account:copypass");
var opts = Common.appRequests().getRequestOpts();
opts.url = ajaxUrl.account.showPass;
opts.url = ajaxUrl.appMgmt.show;
opts.async = false;
opts.data = {
itemId: $obj.data("item-id"),
actionId: $obj.data("action-id"),
isHistory: $obj.data("history"),
isFull: 0,
sk: Common.sk.get(),
isAjax: 1
};
return Common.appRequests().getActionCall(opts);
var response = Common.appRequests().getActionCall(opts);
if (typeof response.responseJSON.csrf !== "undefined") {
Common.sk.set(response.responseJSON.csrf);
}
return response;
},
copy: function ($obj) {
log.info("account:copy");

View File

@@ -575,7 +575,7 @@ sysPass.Main = function () {
text: function (trigger) {
var pass = appActions.account.copypass($(trigger));
return pass.responseJSON.accpass;
return pass.responseJSON.data.accpass;
}
});
@@ -594,11 +594,14 @@ sysPass.Main = function () {
var clipboardUser = new Clipboard(".dialog-clip-user-button");
clipboardPass.on("success", function (e) {
$(".dialog-pass-text").addClass("dialog-clip-pass-copy round");
$(".dialog-user-text").removeClass("dialog-clip-copy");
$(".dialog-pass-text").addClass("dialog-clip-copy");
e.clearSelection();
});
clipboardUser.on("success", function (e) {
$(".dialog-pass-text").removeClass("dialog-clip-copy");
$(".dialog-user-text").addClass("dialog-clip-copy");
e.clearSelection();
});
};