* Updated jQuery version

* Updated ZeroClipboard version
* New temporary master password function
* New help boxes for some functions
* New password box with copy to clipboard function
* Updated some fields on db structure
* Minor bugfixes and UI changes
This commit is contained in:
nuxsmin
2015-03-28 11:51:02 +01:00
parent ec1a5c8cdc
commit 40acdb2ef8
23 changed files with 510 additions and 172 deletions

View File

@@ -225,6 +225,17 @@ if ($frmAction == "config") {
}
SP_Common::printJSON(_('Error al guardar el hash de la clave maestra'));
} elseif ($frmAction == "tmpass") {
$tempMasterMaxTime = SP_Common::parseParams('p', 'tmpass_maxtime', 3600);
$tempMasterPass = SP_Config::setTempMasterPass($tempMasterMaxTime);
if (!empty($tempMasterPass)){
$message['action'] = _('Generar Clave Temporal');
$message['text'][] = SP_Html::strongText(_('Clave') . ': ') . $tempMasterPass;
SP_Common::sendEmail($message);
SP_Common::printJSON(_('Clave Temporal Generada'), 0, $doActionOnClose);
}
} else {
SP_Common::printJSON(_('Acción Inválida'));
}

View File

@@ -126,6 +126,10 @@ if (!$objUser->getUserInfo()) {
if (!$masterPass && (!$objUser->checkUserMPass() || !SP_Users::checkUserUpdateMPass($userLogin) )) {
SP_Common::printJSON(_('La clave maestra no ha sido guardada o es incorrecta'), 3);
} elseif ($masterPass) {
if(SP_Config::checkTempMasterPass($masterPass)){
$masterPass = SP_Config::getTempMasterPass($masterPass);
}
if (!$objUser->updateUserMPass($masterPass)) {
$message['text'][] = _('Clave maestra incorrecta');
SP_Log::wrLogInfo($message);

View File

@@ -317,7 +317,7 @@ switch ($action) {
echo '<DIV ID="tabs">';
echo '<UL>';
echo (SP_ACL::checkUserAccess("config")) ? '<LI><A HREF="#tabs-1" TITLE="' . _('Configuración') . '">' . _('Configuración') . '</A></LI>' : '';
echo (SP_ACL::checkUserAccess("masterpass")) ? '<LI><A HREF="#tabs-2" TITLE="' . _('Clave Maestra') . '">' . _('Clave Maestra') . '</A></LI>' : '';
echo (SP_ACL::checkUserAccess("masterpass")) ? '<LI><A HREF="#tabs-2" TITLE="' . _('Encriptación') . '">' . _('Encriptación') . '</A></LI>' : '';
echo (SP_ACL::checkUserAccess("backup")) ? '<LI><A HREF="#tabs-3" TITLE="' . _('Copia de Seguridad') . '">' . _('Copia de Seguridad') . '</A></LI>' : '';
echo (SP_ACL::checkUserAccess("config")) ? '<LI><A HREF="#tabs-4" TITLE="' . _('Importar cuentas desde fuentes externas') . '">' . _('Importar Cuentas') . '</A></LI>' : '';
echo '</UL>';
@@ -388,6 +388,7 @@ if (isset($_SESSION["uisadminapp"]) && SP_Config::getValue('debug')) {
$debugTxt[] = "<li>SESSION:";
$debugTxt[] = "<pre>" . print_r($_SESSION, true) . "</pre";
$debugTxt[] = "</li>";
// $debugTxt[] = "<li>Master Pass: " . SP_Crypt::getSessionMasterPass() ."</li>";
$debugTxt[] = "<li>CONFIG:<pre>";
$debugTxt[] = "<pre>" . print_r(SP_Config::getKeys(true), true) . "</pre>";
$debugTxt[] = "</li>";

View File

@@ -2,8 +2,8 @@
/**
* sysPass
*
* @author nuxsmin
* @link http://syspass.org
* @author nuxsmin
* @link http://syspass.org
* @copyright 2012-2015 Rubén Domínguez nuxsmin@syspass.org
*
* This file is part of sysPass.
@@ -157,9 +157,9 @@ foreach ($resQuery as $account) {
$color = array_rand($colors);
if (!isset($customerColor)) {
$customerColor[$account->account_customerId] = '#'.$colors[$color];
$customerColor[$account->account_customerId] = '#' . $colors[$color];
} elseif (isset($customerColor) && !array_key_exists($account->account_customerId, $customerColor)) {
$customerColor[$account->account_customerId] = '#'.$colors[$color];
$customerColor[$account->account_customerId] = '#' . $colors[$color];
}
//$hexColor = $customerColor[$account->account_customerId][0];
@@ -215,7 +215,7 @@ foreach ($resQuery as $account) {
}
}
if ($account->account_notes){
if ($account->account_notes) {
$strAccNotes = (strlen($account->account_notes) > 300) ? substr($account->account_notes, 0, 300) . "..." : $account->account_notes;
$strAccNotes = nl2br(wordwrap(htmlspecialchars($strAccNotes), 50, '<br>', true));
}
@@ -286,7 +286,8 @@ foreach ($resQuery as $account) {
if ($accViewPass) {
echo '<img src="imgs/user-pass.png" title="' . _('Ver Clave') . '" onClick="viewPass(' . $account->account_id . ', 1)" />';
echo '<img src="imgs/clipboard.png" title="' . _('Copiar Clave en Portapapeles') . '" onmouseover="viewPass(' . $account->account_id . ', 0)" onmouseout="passToClip = 0;" class="actions-optional clip_pass_button" data-clipboard-target="clip_pass_text" />';
// echo '<img src="imgs/clipboard.png" title="' . _('Copiar Clave en Portapapeles') . '" onmouseover="viewPass(' . $account->account_id . ', true)" onmouseout="passToClip = 0;" class="actions-optional clip-pass-button" data-clipboard-target="clip-pass-text" />';
echo '<img src="imgs/clipboard.png" title="' . _('Copiar Clave en Portapapeles') . '" onmousedown="viewPass(' . $account->account_id . ', false)" class="actions-optional clip-pass-button" data-clipboard-target="clip-pass-text" />';
}
if ($accEdit || $accCopy || $accDel || $accViewPass) {
@@ -326,22 +327,26 @@ SP_Html::printQuerySearchNavBar($sortKey, $arrSearchFilter["limitStart"], $objAc
//echo $objAccount->query;
?>
<div id="clip_pass_text" style="visibility: hidden"></div>
<div id="clip-pass-text" style="visibility: hidden"></div>
<script>
passToClip = 0;
var client = new ZeroClipboard( $('.clip_pass_button'), {
moviePath: "js/ZeroClipboard.swf",
debug: false
});
function clipboard() {
var client = new ZeroClipboard($('.clip-pass-button'), {
swfPath: "js/ZeroClipboard.swf",
debug: false,
title: '<?php echo _('Copiar Clave en Portapapeles'); ?>'
});
//client.setText(data);
client.on( 'load', function(client) {
$('#global-zeroclipboard-html-bridge').attr('rel', 'tooltip').attr('title', '<?php echo _('Copiar Clave en Portapapeles'); ?>');
});
client.on("aftercopy", function (e) {
resMsg("ok", "<?php echo _('Clave Copiada al Portapapeles'); ?>");
});
client.on( "complete", function(client, args) {
resMsg("ok", "<?php echo _('Clave Copiada al Portapapeles'); ?>");
});
client.on("error", function (e) {
ZeroClipboard.destroy();
});
}
clipboard();
</script>

View File

@@ -33,7 +33,6 @@ if (!SP_Init::isLoggedIn()) {
}
$accountId = SP_Common::parseParams('p', 'accountid', false);
$fullTxt = SP_Common::parseParams('p', 'full', 0);
$isHistory = SP_Common::parseParams('p', 'isHistory', false);
if (!$accountId) {
@@ -48,28 +47,23 @@ $account->accountId = $accountId;
$accountData = $account->getAccountPass($isHistory);
if ($isHistory && !$account->checkAccountMPass()){
echo '<div id="fancyMsg" class="msgError">' . _('La clave maestra no coincide') . '</div>';
return;
SP_Common::printJSON(_('La clave maestra no coincide'));
}
$accountData = $account->getAccountPass($isHistory);
if (!SP_ACL::checkAccountAccess("accviewpass", $account->getAccountDataForACL()) || !SP_ACL::checkUserAccess("accviewpass")) {
die('<span class="altTxtRed">' . _('No tiene permisos para acceder a esta cuenta') . '</span>');
SP_Common::printJSON(_('No tiene permisos para acceder a esta cuenta'));
}
if (!SP_Users::checkUserUpdateMPass()) {
if ($fullTxt) {
die('<div id="fancyMsg" class="msgError">' . _('Clave maestra actualizada') . '<br>' . _('Reinicie la sesión para cambiarla') . '</div>');
} else {
die(_('Clave maestra actualizada') . '<br>' . _('Reinicie la sesión para cambiarla'));
}
SP_Common::printJSON(_('Clave maestra actualizada') . '<br>' . _('Reinicie la sesión para cambiarla'));
}
$masterPass = SP_Crypt::getSessionMasterPass();
$accountClearPass = SP_Crypt::getDecrypt($accountData->pass, $masterPass, $accountData->iv);
if (!$isHistory && $fullTxt) {
if (!$isHistory) {
$account->incrementDecryptCounter();
$message['action'] = _('Ver Clave');
@@ -81,22 +75,10 @@ if (!$isHistory && $fullTxt) {
$accountPass = htmlentities(trim($accountClearPass),ENT_COMPAT,'UTF-8');
if ($fullTxt) {
?>
<div id="fancyMsg" class="msgInfo">
<table>
<tr>
<td><span class="altTxtBlue"><?php echo _('Usuario'); ?></span></td>
<td><?php echo $accountData->login; ?></td>
</tr>
<tr>
<td><span class="altTxtBlue"><?php echo _('Clave'); ?></span></td>
<td><?php echo $accountPass; ?></td>
</tr>
</table>
</div>
<?php
} else {
echo $accountPass;
}
?>
$data = array(
'title' => _('Clave de Cuenta'),
// 'acclogin' => _('Usuario') . ': ' . $accountData->login,
'accpass' => $accountPass
);
SP_Common::printJSON($data, 0);

View File

@@ -73,26 +73,29 @@ input, select, textarea {
background-color: #fffef0;
color: black;
font-size: 11px;
padding: 5px;
}
td>input, td>select, td>textarea {
border: 1px solid #dfdfdf;
border-radius: 5px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
box-shadow: 0 0 8px rgba(0, 0, 0, 0.075) inset;
padding: 5px;
}
input:hover, select:hover, textarea:hover {
background-color: #fffccd;
}
input:active, select:hover, textarea:active {
td>input:active, td>select:hover, td>textarea:active {
background-color: #fffde1;
color: #045FB4;
border: 1px solid #5897fb;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1) inset, 0 0 5px rgba(88, 151, 251, 0.5);
}
input:focus, select:hover, textarea:focus {
td>input:focus, td>select:hover, td>textarea:focus {
background-color: #fffccd;
color: #045FB4;
border: 1px solid #5897fb;
@@ -1478,6 +1481,16 @@ footer img {
font-weight: bold;
}
.dialog-pass-text{padding: .5em; border: transparent 1px solid; text-align: center; min-width: 200px; }
.dialog-buttons{text-align: center; padding: .5em; border-top: 1px solid #c9c9c9; line-height: 2.5em;}
.dialog-clip-pass-copy {
background-color: #ecfde4;;
color: green;
border: #dbfdcb 1px solid;
}
.help-text{text-align: justify; line-height: 1.5em; margin-top: 1em;}
/*Login Page*/
#boxLogin {
width: 450px;
@@ -1750,11 +1763,22 @@ fieldset.warning a {
text-align: center;
}
#whatsNewIcon {text-align: center;}
#whatsNewIcon img{width: 64px; height: 64px;}
#whatsNewIcon h2{display: inline-block; color: #555; font-size: 16px;}
#whatsNewIcon {
text-align: center;
}
#whatsNew{
#whatsNewIcon img {
width: 64px;
height: 64px;
}
#whatsNewIcon h2 {
display: inline-block;
color: #555;
font-size: 16px;
}
#whatsNew {
margin: 0 auto;
width: 500px;
background-color: #fffde1;
@@ -1767,7 +1791,11 @@ fieldset.warning a {
display: none;
}
#whatsNew ul{padding: 0; border: none;}
#whatsNew ul {
padding: 0;
border: none;
}
#whatsNew li {
padding-left: 37px;
background: url("../imgs/arrow-list.png") left center no-repeat;

View File

@@ -2,8 +2,8 @@
/**
* sysPass
*
* @author nuxsmin
* @link http://syspass.org
* @author nuxsmin
* @link http://syspass.org
* @copyright 2012-2015 Rubén Domínguez nuxsmin@syspass.org
*
* This file is part of sysPass.
@@ -35,7 +35,7 @@ class SP_Common
*
* @param array $message con el nombre de la accióm y el texto del mensaje
* @param string $mailTo con el destinatario
* @param bool $isEvent para indicar si es um
* @param bool $isEvent para indicar si es um
* @return bool
*/
public static function sendEmail($message, $mailTo = '', $isEvent = true)
@@ -152,7 +152,7 @@ class SP_Common
* Devuelve una respuesta en formato XML con el estado y el mensaje.
*
* @param string $description mensaje a devolver
* @param int $status devuelve el estado
* @param int $status devuelve el estado
* @return bool
*/
public static function printXML($description, $status = 1)
@@ -176,23 +176,37 @@ class SP_Common
/**
* Devuelve una respuesta en formato JSON con el estado y el mensaje.
*
* @param string $description mensaje a devolver
* @param int $status devuelve el estado
* @param string $action con la accion a realizar
* @param string|array $data mensaje a devolver
* @param int $status devuelve el estado
* @param string $action con la accion a realizar
* @return bool
*/
public static function printJSON($description, $status = 1, $action = '')
public static function printJSON($data, $status = 1, $action = '')
{
if (!is_string($description)) {
if (!is_string($data) && !is_array($data)) {
return false;
}
$arrStrFrom = array("\\", '"', "'");
$arrStrTo = array("\\", '\"', "\'");
$cleanDescription = str_replace($arrStrFrom, $arrStrTo, $description);
if (!is_array($data)) {
$json = array(
'status' => $status,
'description' => str_replace($arrStrFrom, $arrStrTo, $data),
'action' => $action
);
} else {
array_walk($data,
function (&$value, &$key, $arrStrFrom, $arrStrTo) {
return str_replace($arrStrFrom, $arrStrTo, $value);
}
);
$json = array('status' => $status, 'description' => $cleanDescription, 'action' => $action);
$data['status'] = $status;
$data['action'] = $action;
$json = $data;
}
header('Content-type: application/json');
exit(json_encode($json));
@@ -202,7 +216,7 @@ class SP_Common
* Devuelve un icono de ayuda con el mensaje.
*
* @param int $type tipo de mensaje
* @param int $id id del mensaje
* @param int $id id del mensaje
* @return string Con la etiqueta html del icono de ayuda
*/
public static function printHelpButton($type, $id)
@@ -281,12 +295,12 @@ class SP_Common
* Obtener los valores de variables $_GET, $_POST, $_REQUEST o $_SESSION
* y devolverlos limpios con el tipo correcto o esperado.
*
* @param string $method con el método a utilizar
* @param string $param con el parámetro a consultar
* @param mixed $default opcional, valor por defecto a devolver
* @param string $method con el método a utilizar
* @param string $param con el parámetro a consultar
* @param mixed $default opcional, valor por defecto a devolver
* @param bool $onlyCHeck opcional, comprobar si el parámetro está presente
* @param mixed $force opcional, valor devuelto si el parámeto está definido
* @param bool $sanitize opcional, escapar/eliminar carácteres especiales
* @param mixed $force opcional, valor devuelto si el parámeto está definido
* @param bool $sanitize opcional, escapar/eliminar carácteres especiales
* @return bool|string si está presente el parámeto en la petición devuelve bool. Si lo está, devuelve el valor.
*/
public static function parseParams($method, $param, $default = '', $onlyCHeck = false, $force = false, $sanitize = true)

View File

@@ -130,9 +130,10 @@ class SP_Config
*
* @param string $param con el parámetro a guardar
* @param string $value con el calor a guardar
* @param bool $email enviar email?
* @return bool
*/
public static function setConfigValue($param, $value)
public static function setConfigValue($param, $value, $email = true)
{
$query = "INSERT INTO config "
. "SET config_parameter = :param,"
@@ -153,7 +154,10 @@ class SP_Config
$message['text'][] = _('Valor') . ': ' . $value;
SP_Log::wrLogInfo($message);
SP_Common::sendEmail($message);
if ($email === true) {
SP_Common::sendEmail($message);
}
return true;
}
@@ -367,4 +371,73 @@ class SP_Config
self::writeData();
return true;
}
/**
* Crea una clave temporal para encriptar la clave maestra y guardarla.
*
* @return bool|string
*/
public static function setTempMasterPass($maxTime = 14400)
{
// Encriptar la clave maestra con hash aleatorio generado
$randomHash = SP_Util::generate_random_bytes(32);
$pass = SP_Crypt::mkCustomMPassEncrypt($randomHash, SP_Crypt::getSessionMasterPass());
if (!is_array($pass)){
return false;
}
self::setConfigValue('tempmaster_pass', bin2hex($pass[0]), false);
self::setConfigValue('tempmaster_passiv', bin2hex($pass[1]), false);
self::setConfigValue('tempmaster_passhash', sha1($randomHash), false);
self::setConfigValue('tempmaster_passtime', time(), false);
self::setConfigValue('tempmaster_maxtime', time() + $maxTime, false);
self::setConfigValue('tempmaster_attempts', 0, false);
return $randomHash;
}
/**
* Comprueba si la clave temporal es válida
*
* @param string $pass clave a comprobar
* @return bool
*/
public static function checkTempMasterPass($pass)
{
$passTime = self::getConfigValue('tempmaster_passtime');
$passMaxTime = self::getConfigValue('tempmaster_maxtime');
$attempts = self::getConfigValue('tempmaster_attempts');
// Comprobar si el tiempo de validez se ha superado
if ($passTime !== false && time() - $passTime > $passMaxTime || $attempts >= 5){
self::setConfigValue('tempmaster_pass', '', false);
self::setConfigValue('tempmaster_passiv', '', false);
self::setConfigValue('tempmaster_passhash', '', false);
return false;
}
$isValid = (self::getConfigValue('tempmaster_passhash') == sha1($pass));
if (!$isValid){
self::setConfigValue('tempmaster_attempts', $attempts + 1, false);
}
return $isValid;
}
/**
* Devuelve la clave maestra que ha sido encriptada con la clave temporal
*
* @param $pass con la clave utilizada para encriptar
* @return string con la clave maestra desencriptada
*/
public static function getTempMasterPass($pass)
{
$passLogin = hex2bin(self::getConfigValue('tempmaster_pass'));
$passLoginIV = hex2bin(self::getConfigValue('tempmaster_passiv'));
return SP_Crypt::getDecrypt($passLogin, $pass, $passLoginIV);
}
}

View File

@@ -63,7 +63,7 @@ CREATE TABLE `accHistory` (
`acchistory_categoryId` tinyint(3) unsigned NOT NULL,
`acchistory_login` varchar(50) NOT NULL,
`acchistory_url` varchar(255) DEFAULT NULL,
`acchistory_pass` varbinary(32) NOT NULL,
`acchistory_pass` varbinary(255) NOT NULL,
`acchistory_IV` varbinary(32) NOT NULL,
`acchistory_notes` text NOT NULL,
`acchistory_countView` int(10) unsigned NOT NULL DEFAULT '0',
@@ -113,7 +113,7 @@ CREATE TABLE `accounts` (
`account_categoryId` tinyint(3) unsigned NOT NULL,
`account_login` varchar(50) DEFAULT NULL,
`account_url` varchar(255) DEFAULT NULL,
`account_pass` varbinary(32) NOT NULL,
`account_pass` varbinary(255) NOT NULL,
`account_IV` varbinary(32) NOT NULL,
`account_notes` text,
`account_countView` int(10) unsigned NOT NULL DEFAULT '0',
@@ -208,8 +208,8 @@ CREATE TABLE `usrData` (
`user_groupId` tinyint(3) unsigned NOT NULL,
`user_secGroupId` tinyint(3) unsigned DEFAULT NULL,
`user_login` varchar(50) NOT NULL,
`user_pass` varbinary(40) NOT NULL,
`user_mPass` varbinary(32) DEFAULT NULL,
`user_pass` varbinary(255) NOT NULL,
`user_mPass` varbinary(255) DEFAULT NULL,
`user_mIV` varbinary(32) NOT NULL,
`user_email` varchar(80) DEFAULT NULL,
`user_notes` text,

View File

@@ -524,9 +524,9 @@ $maxFileSize = round(SP_Config::getValue('files_allowed_size') / 1024, 1);
</li>
<li>
<img src="imgs/clipboard.png" title="<?php echo _('Copiar Clave en Portapapeles'); ?>"
onmouseover="viewPass(<?php echo $account->accountId; ?>,0,<?php echo $account->accountIsHistory; ?>)"
data-clipboard-target="clip_pass_text"
class="inputImg clip_pass_button"/>
onmousedown="viewPass(<?php echo $account->accountId; ?>, false, <?php echo $account->accountIsHistory; ?>)"
data-clipboard-target="clip-pass-text"
class="inputImg clip-pass-button"/>
</li>
<?php endif; ?>
@@ -600,24 +600,27 @@ $maxFileSize = round(SP_Config::getValue('files_allowed_size') / 1024, 1);
<?php endif; ?>
<?php if ($showViewPass): ?>
<div id="clip_pass_text" style="visibility: hidden"></div>
<div id="clip-pass-text" style="visibility: hidden"></div>
<script>
passToClip = 0;
var client = new ZeroClipboard( $('.clip_pass_button'), {
moviePath: "js/ZeroClipboard.swf",
debug: true
} );
function clipboard() {
var client = new ZeroClipboard($('.clip-pass-button'), {
swfPath: "js/ZeroClipboard.swf",
debug: false,
title: '<?php echo _('Copiar Clave en Portapapeles'); ?>'
});
//client.setText(data);
client.on( 'load', function(client) {
$('#global-zeroclipboard-html-bridge').attr('rel', 'tooltip').attr('title', '<?php echo _('Copiar Clave en Portapapeles'); ?>');
} );
client.on("aftercopy", function (e) {
resMsg("ok", "<?php echo _('Clave Copiada al Portapapeles'); ?>");
});
client.on( "complete", function(client, args) {
resMsg("ok", "<?php echo _('Clave Copiada al Portapapeles'); ?>");
//console.log("Copied text to clipboard: " + args.text );
} );
client.on("error", function (e) {
ZeroClipboard.destroy();
});
}
clipboard();
</script>
<?php endif; ?>

View File

@@ -82,5 +82,19 @@ $lastBackupTime = (file_exists($backupFile['absolute'])) ? _('Último backup') .
<img src="imgs/backup.png" title="<?php echo _('Realizar Backup'); ?>" class="inputImg"
OnClick="configMgmt('backup');"/>
</li>
<li>
<img id="help_backup_button" src="imgs/help.png" title="<?php echo _('Ayuda'); ?>" class="inputImg" />
<div id="help_backup" class="help-box" title="<?php echo _('Ayuda'); ?>">
<p class="help-text"><?php echo _('La copia de seguridad permite guardar y descargar tanto la base de datos de sysPass como los archivos de la aplicación y su configuración.'); ?></p>
<p class="help-text"><?php echo _('Con este método es posible guardar todos los datos de sysPass en otro lugar o utilizarlos para hacer la aplicación portable.'); ?></p>
</div>
</li>
</ul>
</div>
</div>
<script>
$(".help-box").dialog({autoOpen: false, title: '<?php echo _('Ayuda'); ?>'});
$("#help_backup_button").click(function() {
$("#help_backup").dialog("open");
});
</script>

View File

@@ -106,7 +106,7 @@ $profilesSelProp = array('name' => 'ldap_defaultprofile',
<?php echo _('Timeout de sesión (s)'); ?>
</td>
<td class="valField">
<input type="text" name="session_timeout" value="<?php echo SP_Config::getValue('session_timeout'); ?>" maxlength="4" <?php echo $isDisabled; ?> />
<input type="text" name="session_timeout" id="session_timeout" value="<?php echo SP_Config::getValue('session_timeout'); ?>" maxlength="4" <?php echo $isDisabled; ?> />
</td>
</tr>
<tr>
@@ -194,7 +194,7 @@ $profilesSelProp = array('name' => 'ldap_defaultprofile',
<?php echo SP_Common::printHelpButton("config", 6); ?>
</td>
<td class="valField">
<input type="text" name="files_allowed_size" value="<?php echo SP_Config::getValue('files_allowed_size'); ?>" maxlength="5" <?php echo $isDisabled; ?> />
<input type="text" name="files_allowed_size" id="files_allowed_size" value="<?php echo SP_Config::getValue('files_allowed_size'); ?>" maxlength="5" <?php echo $isDisabled; ?> />
</td>
</tr>
<tr>
@@ -203,14 +203,7 @@ $profilesSelProp = array('name' => 'ldap_defaultprofile',
<?php echo SP_Common::printHelpButton("config", 4); ?>
</td>
<td class="valField">
<select name="account_count" id="sel-account_count" size="1">
<?php
foreach ($arrAccountCount as $num ){
$selected = ( SP_Config::getValue('account_count') == $num) ? 'SELECTED' : '';
echo "<option $selected>$num</option>";
}
?>
</select>
<input type="text" name="account_count" id="sel-account_count" value="<?php echo SP_Config::getValue('account_count'); ?>" maxlength="5" <?php echo $isDisabled; ?> />
</td>
</tr>
<tr>
@@ -491,7 +484,7 @@ $profilesSelProp = array('name' => 'ldap_defaultprofile',
</div>
<script>
$("#sel-sitelang,#sel-account_link,#sel-account_count,#sel-mailsecurity").chosen({disable_search : true});
$("#sel-sitelang,#sel-account_link,#sel-mailsecurity").chosen({disable_search : true});
$('#frmConfig').find('.checkbox').button();
$('#frmConfig').find('.ui-button').click(function(){
// El cambio de clase se produce durante el evento de click
@@ -513,21 +506,17 @@ $profilesSelProp = array('name' => 'ldap_defaultprofile',
// Fix scrolling to bottom
var $tagsbox = $(this).next();
$tagsbox.animate({scrollTop: $tagsbox.height()});
if ( $tagsbox.find('img:last').attr('alt') != 'warning' ){
$tagsbox.find('div:last').prev().append('<img src="imgs/warning.png" alt="warning" class="iconMini" title="' + LANG[13] + '" />');
$tagsbox.find('div:last').prev().append('<img src="imgs/warning.png" alt="warning" class="iconMini" title="' + LANG[5] + '" />');
}
},
'onRemoveTag' : function(){
'onRemoveTag' : function(){
var $tagsbox = $(this).next();
if ( $tagsbox.find('img:last').attr('alt') != 'warning' ){
$tagsbox.find('div:last').prev().append('<img src="imgs/warning.png" alt="warning" class="iconMini" title="' + LANG[13] + '"/>');
$tagsbox.find('div:last').prev().append('<img src="imgs/warning.png" alt="warning" class="iconMini" title="' + LANG[5] + '"/>');
}
},
onChange : function(){
// Fix tooltip on refresh the tags list
$(this + '[title]').powerTip(powertipOptions);
}
});
$('#wikifilter').tagsInput({
@@ -540,25 +529,22 @@ $profilesSelProp = array('name' => 'ldap_defaultprofile',
// Fix scrolling to bottom
var $tagsbox = $(this).next();
$tagsbox.animate({scrollTop: $tagsbox.height()});
if ( $tagsbox.find('img:last').attr('alt') != 'warning' ){
$tagsbox.find('div:last').prev().append('<img src="imgs/warning.png" alt="warning" class="iconMini" title="' + LANG[13] + '"/>');
$tagsbox.find('div:last').prev().append('<img src="imgs/warning.png" alt="warning" class="iconMini" title="' + LANG[5] + '"/>');
}
},
onRemoveTag : function(){
var $tagsbox = $(this).next();
if ( $tagsbox.find('img:last').attr('alt') != 'warning' ){
$tagsbox.find('div:last').prev().append('<img src="imgs/warning.png" alt="warning" class="iconMini" title="' + LANG[13] + '"/>');
$tagsbox.find('div:last').prev().append('<img src="imgs/warning.png" alt="warning" class="iconMini" title="' + LANG[5] + '"/>');
}
},
onChange : function(){
var $tagsbox = $(this).next();
last_width = $tagsbox.find("span:last").width() + 10;
var last_width = $tagsbox.find("span:last").width() + 10;
$tagsbox.find(".tag:last").css('width', last_width);
// Fix tooltip on refresh the tags list
$(this + '[title]').powerTip(powertipOptions);
}
});
$("#ldap_defaultgroup").chosen({
@@ -571,4 +557,7 @@ $profilesSelProp = array('name' => 'ldap_defaultprofile',
disable_search_threshold: 10,
no_results_text: "<?php echo _('Sin resultados'); ?>"
});
$("#session_timeout").spinner({step: 300, min: 300, numberFormat: "n"});
$("#files_allowed_size").spinner({step: 1024, min: 1024, numberFormat: "n"});
$("#sel-account_count").spinner({step: 6, max: 100, min: 6, numberFormat: "n"});
</script>

View File

@@ -67,7 +67,7 @@ $chpass = ( ! isset($_SESSION['uisldap']) || $_SESSION['uisldap'] == 0 ) ? '<img
continue;
}
echo '<li class="round"><img src="' . SP_Init::$WEBROOT . '/imgs/' . $action['img'] . '" title="' . _($action['title']) . '" OnClick="doAction(\'' . $action['name'] . '\')" /></li>';
echo '<li class="round" title="' . _($action['title']) . '" OnClick="doAction(\'' . $action['name'] . '\')"><img src="' . SP_Init::$WEBROOT . '/imgs/' . $action['img'] . '"/></li>';
}
?>
</ul>

View File

@@ -2,8 +2,8 @@
/**
* sysPass
*
* @author nuxsmin
* @link http://syspass.org
* @author nuxsmin
* @link http://syspass.org
* @copyright 2012-2015 Rubén Domínguez nuxsmin@syspass.org
*
* This file is part of sysPass.
@@ -32,8 +32,14 @@ $onCloseAction = $data['onCloseAction'];
SP_ACL::checkUserAccess($action) || SP_Html::showCommonError('unavailable');
$lastUpdateMPass = SP_Config::getConfigValue("lastupdatempass");
$tempMasterPassTime = SP_Config::getConfigValue("tempmaster_passtime");
$tempMasterMaxTime = SP_Config::getConfigValue("tempmaster_maxtime");
?>
<div id="title" class="midroundup titleNormal">
<?php echo _('Clave Maestra'); ?>
</div>
<form method="post" name="frmCrypt" id="frmCrypt">
<table class="data tblConfig round">
<?php if ($lastUpdateMPass > 0): ?>
@@ -113,6 +119,80 @@ $lastUpdateMPass = SP_Config::getConfigValue("lastupdatempass");
<img src="imgs/check.png" title="<?php echo _('Guardar'); ?>" class="inputImg"
OnClick="configMgmt('savempwd');"/>
</li>
<li>
<img id="help_mpass_button" src="imgs/help.png" title="<?php echo _('Ayuda'); ?>" class="inputImg" />
<div id="help_mpass" class="help-box" title="<?php echo _('Ayuda'); ?>">
<p class="help-text"><?php echo _('La clave maestra es utilizada para encriptar las claves de las cuentas de sysPass para mantenerlas seguras.'); ?></p>
<p class="help-text"><?php echo _('Es recomendable cambiarla cada cierto tiempo y utilizar una clave compleja que incluya números, letras y símbolos.'); ?></p>
</div>
</li>
</ul>
</div>
<div id="title" class="midroundup titleNormal">
<?php echo _('Clave Temporal'); ?>
</div>
<form method="post" name="frmTempMasterPass" id="frmTempMasterPass">
<table class="data tblConfig round">
<tr>
<td class="descField">
<?php echo _('Último cambio'); ?>
</td>
<td class="valField">
<?php
if ($tempMasterPassTime > 0) {
echo date("r", $tempMasterPassTime);
} else {
echo _('No generada');
}
?>
</td>
</tr>
<tr>
<td class="descField">
<?php echo _('Válido hasta'); ?>
</td>
<td class="valField">
<?php
if (time() > $tempMasterMaxTime) {
echo '<span style="color: red">' . date("r", $tempMasterMaxTime) . '</span>';
} elseif ($tempMasterMaxTime > 0) {
echo date("r", $tempMasterMaxTime);
} else {
echo _('No generada');
}
?>
</td>
</tr>
<tr>
<td class="descField">
<?php echo _('Validez (s)'); ?>
</td>
<td class="valField">
<input type="text" name="tmpass_maxtime" id="tmpass_maxtime" title="<?php echo _('Validez'); ?>"
value="3600"/>
</td>
</tr>
</table>
<input type="hidden" name="activeTab" value="<?php echo $activeTab ?>"/>
<input type="hidden" name="onCloseAction" value="<?php echo $onCloseAction ?>"/>
<input type="hidden" name="action" value="tmpass"/>
<input type="hidden" name="isAjax" value="1"/>
<input type="hidden" name="sk" value="<?php echo SP_Common::getSessionKey(); ?>">
</form>
<div class="action">
<ul>
<li>
<img src="imgs/genpass.png" title="<?php echo _('Generar'); ?>" class="inputImg"
OnClick="configMgmt('gentmpass');"/>
</li>
<li>
<img id="help_tmpass_button" src="imgs/help.png" title="<?php echo _('Ayuda'); ?>" class="inputImg" />
<div id="help_tmpass" class="help-box" title="<?php echo _('Ayuda'); ?>">
<p class="help-text"><?php echo _('La clave temporal es utilizada como clave maestra para los usuarios que necesitan introducirla al iniciar la sesión, así no es necesario facilitar la clave maestra original.'); ?></p>
</div>
</li>
</ul>
</div>
@@ -127,4 +207,16 @@ $lastUpdateMPass = SP_Config::getConfigValue("lastupdatempass");
$(this).children().html('<?php echo _('SI'); ?>');
}
});
$("#tmpass_maxtime").spinner({
step: 60, min: 60, numberFormat: "n", stop: function (event, ui) {
accSearch(0);
}
});
$(".help-box").dialog({autoOpen: false, title: '<?php echo _('Ayuda'); ?>'});
$("#help_tmpass_button").click(function() {
$("#help_tmpass").dialog("open");
});
$("#help_mpass_button").click(function() {
$("#help_mpass").dialog("open");
});
</script>

View File

@@ -31,7 +31,7 @@ defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo'
*/
class SP_Upgrade
{
private static $dbUpgrade = array(110, 1121, 1122, 1123, 11213, 12001);
private static $dbUpgrade = array(110, 1121, 1122, 1123, 11213, 11219, 11220, 12001);
private static $cfgUpgrade = array(1124);
/**
@@ -89,6 +89,13 @@ class SP_Upgrade
$queries[] = 'ALTER TABLE `usrData` CHANGE COLUMN `user_mPass` `user_mPass` VARBINARY(32) NULL DEFAULT NULL ,CHANGE COLUMN `user_lastLogin` `user_lastLogin` DATETIME NULL DEFAULT NULL ,CHANGE COLUMN `user_lastUpdate` `user_lastUpdate` DATETIME NULL DEFAULT NULL, CHANGE COLUMN `user_mIV` `user_mIV` VARBINARY(32) NULL ;';
$queries[] = 'ALTER TABLE `accounts` CHANGE COLUMN `account_login` `account_login` VARCHAR(50) NULL DEFAULT NULL ;';
break;
case 11219:
$queries[] = 'ALTER TABLE `accounts` CHANGE COLUMN `account_pass` `account_pass` VARBINARY(255) NOT NULL ;';
$queries[] = 'ALTER TABLE `accHistory` CHANGE COLUMN `acchistory_pass` `acchistory_pass` VARBINARY(255) NOT NULL ;';
break;
case 11220:
$queries[] = 'ALTER TABLE `usrData` CHANGE COLUMN `user_pass` `user_pass` VARBINARY(255) NOT NULL,CHANGE COLUMN `user_mPass` `acchistory_pass` VARBINARY(255) DEFAULT NULL ;';
break;
case 12001:
$queries[] = 'ALTER TABLE `accounts` CHANGE COLUMN `account_userEditId` `account_userEditId` TINYINT(3) UNSIGNED NULL DEFAULT NULL, CHANGE COLUMN `account_dateEdit` `account_dateEdit` DATETIME NULL DEFAULT NULL;';
$queries[] = 'ALTER TABLE `accHistory` CHANGE COLUMN `acchistory_userEditId` `acchistory_userEditId` TINYINT(3) UNSIGNED NULL DEFAULT NULL, CHANGE COLUMN `acchistory_dateEdit` `acchistory_dateEdit` DATETIME NULL DEFAULT NULL;';

View File

@@ -1063,7 +1063,7 @@ class SP_Users
if ($showPass == true) {
return $clearMasterPass;
} else {
$_SESSION['mPassPwd'] = substr(sha1(uniqid()), 0, 32);
$_SESSION['mPassPwd'] = SP_Util::generate_random_bytes(32);
$sessionMasterPass = SP_Crypt::mkCustomMPassEncrypt($_SESSION["mPassPwd"], $clearMasterPass);

View File

@@ -506,7 +506,7 @@ class SP_Util
* @param array $files archivos a parsear
* @return none
*/
public static function getMinified($type, &$files)
public static function getMinified($type, &$files, $disableMinify = false)
{
$offset = 3600 * 24 * 30;
$nextCheck = time() + $offset;
@@ -542,7 +542,7 @@ class SP_Util
foreach ($files as $file) {
$filePath = $path . $file['href'];
if ($file['min'] === true) {
if ($file['min'] === true && $disableMinify === false) {
echo '/* MINIFIED FILE: ' . $file['href'] . ' */' . PHP_EOL;
if ($type == 'js') {
echo self::jsCompress(file_get_contents($filePath));

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@@ -8,6 +8,8 @@ order.dir = 0;
var passToClip = 0;
// Variable para el ajuste óptimo del contenido a la altura del documento
var windowAdjustSize = 350;
// Variable para almacena la llamada a setTimeout()
var timeout;
var strPassword;
var minPasswordLength = 8;
@@ -36,7 +38,7 @@ jQuery.extend(jQuery.fancybox.defaults, {
autoHeight: 'true',
minHeight: 50,
padding: 0,
helpers: {overlay: { css: { 'background': 'rgba(0, 0, 0, 0.1)'}}},
helpers: {overlay: {css: {'background': 'rgba(0, 0, 0, 0.1)'}}},
afterShow: function () {
"use strict";
@@ -58,6 +60,31 @@ $(document).ready(function () {
$('input, textarea').placeholder();
});
//$(function() {
// "use strict";
//
// $.ajaxSetup({
// error: function(jqXHR, exception) {
// if (jqXHR.status === 0) {
// $('#content').fadeIn().html(resMsg("nofancyerror", jqXHR.responseText));
// } else if (jqXHR.status == 404) {
// $('#content').fadeIn().html(resMsg("nofancyerror", jqXHR.responseText));
// } else if (jqXHR.status == 500) {
// $('#content').fadeIn().html(resMsg("nofancyerror", jqXHR.responseText));
// } else if (exception === 'parsererror') {
// $('#content').fadeIn().html(resMsg("nofancyerror", jqXHR.responseText));
// } else if (exception === 'timeout') {
// $('#content').fadeIn().html(resMsg("nofancyerror", jqXHR.responseText));
// } else if (exception === 'abort') {
// $('#content').fadeIn().html(resMsg("nofancyerror", jqXHR.responseText));
// } else {
// $('#content').fadeIn().html(resMsg("nofancyerror", jqXHR.responseText));
// //alert('Uncaught Error.n' + jqXHR.responseText);
// }
// }
// });
//});
// Función para cargar el contenido de la acción del menú seleccionada
function doAction(action, lastAction, id) {
"use strict";
@@ -113,7 +140,7 @@ function setWindowAdjustSize() {
function scrollUp() {
"use strict";
$('html, body').animate({ scrollTop: 0 }, 'slow');
$('html, body').animate({scrollTop: 0}, 'slow');
}
// Función para limpiar un formulario
@@ -268,20 +295,78 @@ function viewPass(id, full, history) {
$.ajax({
type: 'POST',
url: APP_ROOT + '/ajax/ajax_viewpass.php',
dataType: "json",
async: false,
data: {'accountid': id, 'full': full, 'isHistory': history, 'isAjax': 1},
success: function (data) {
if (data === "-1") {
doLogout();
} else {
if (full === 0) {
// Copiamos la clave en el objeto que tiene acceso al portapapeles
$('#clip_pass_text').html(data);
passToClip = 1;
} else {
resMsg("none", data);
}
success: function (json) {
if (full === false) {
// Copiamos la clave en el objeto que tiene acceso al portapapeles
$('#clip-pass-text').html(json.accpass);
passToClip = 1;
return;
}
$('<div></div>').dialog({
modal: true,
title: json.title,
width: 'auto',
open: function () {
var content;
if (json.status === 0) {
content = '<p class="dialog-pass-text">' + json.accpass + '</p>' +
'<br>' +
'<div class="dialog-buttons">' +
'<button id="dialog-clip-pass-button-' + id + '" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-primary">' +
'<span class="ui-button-icon-primary ui-icon ui-icon-clipboard"></span>' +
'<span class="ui-button-text">Copiar</span>' +
'</button>' +
'</div>';
} else {
content = '<span class="altTxtRed">' + json.description + '</span>';
$(this).dialog("option", "buttons",
[{
text: "Ok",
icons: {primary: "ui-icon-close"}, click: function () {
$(this).dialog("close");
}
}]
);
}
$(this).html(content);
// Recentrar después de insertar el contenido
$(this).dialog('option', 'position', 'center');
// Carga de objeto flash para copiar al portapapeles
var client = new ZeroClipboard($("#dialog-clip-pass-button-" + id), {swfPath: "js/ZeroClipboard.swf"});
client.on('ready', function (e) {
$("#dialog-clip-pass-button-" + id).attr("data-clip", 1);
client.on('copy', function (e) {
e.clipboardData.setData('text/plain', json.accpass);
});
client.on('aftercopy', function (e) {
$('.dialog-pass-text').addClass('dialog-clip-pass-copy round');
});
});
client.on('error', function (e) {
ZeroClipboard.destroy();
});
// Timeout del mensaje
var $this = $(this);
timeout = setTimeout(function(){$this.dialog('close');}, 30000);
},
// Forzar la eliminación del objeto para que ZeroClipboard siga funcionando al abrirlo de nuevo
close: function () {
clearTimeout(timeout);
$(this).dialog("destroy");
}
});
}
});
}
@@ -341,7 +426,8 @@ function doLogin() {
404: function () {
var txt = LANG[1] + '<p>' + LANG[13] + '</p>';
resMsg("error", txt);
}}
}
}
});
return false;
@@ -461,6 +547,10 @@ function configMgmt(action) {
frm = 'frmCrypt';
url = '/ajax/ajax_configSave.php';
break;
case "gentmpass":
frm = 'frmTempMasterPass';
url = '/ajax/ajax_configSave.php';
break;
case "backup":
frm = 'frmBackup';
url = '/ajax/ajax_backup.php';
@@ -773,7 +863,7 @@ function appMgmtSave(frmId, isDel, id, type, sk, nextaction) {
var url = '/ajax/ajax_appMgmtSave.php';
if (isDel === 1) {
data = {'id': id, 'type': type, 'action': 4, 'sk': sk, 'activeTab': frmId, 'onCloseAction': nextaction };
data = {'id': id, 'type': type, 'action': 4, 'sk': sk, 'activeTab': frmId, 'onCloseAction': nextaction};
var atext = '<div id="alert"><p id="alert-text">' + LANG[12] + '</p></div>';
alertify.confirm(atext, function (e) {
@@ -813,7 +903,7 @@ function clearEventlog(sk) {
alertify.confirm(atext, function (e) {
if (e) {
var data = { 'clear': 1, 'sk': sk, 'isAjax': 1};
var data = {'clear': 1, 'sk': sk, 'isAjax': 1};
var url = '/ajax/ajax_eventlog.php';
sendAjax(data, url);
@@ -1000,9 +1090,11 @@ function resMsg(type, txt, url, action) {
"use strict";
if (typeof url !== "undefined") {
$.ajax({ url: url, type: 'get', dataType: 'html', async: false, success: function (data) {
txt = data;
}});
$.ajax({
url: url, type: 'get', dataType: 'html', async: false, success: function (data) {
txt = data;
}
});
}
var html;
@@ -1011,13 +1103,13 @@ function resMsg(type, txt, url, action) {
switch (type) {
case "ok":
alertify.set({ beforeCloseAction: action });
alertify.set({beforeCloseAction: action});
return alertify.success(txt);
case "error":
alertify.set({ beforeCloseAction: action });
alertify.set({beforeCloseAction: action});
return alertify.error(txt);
case "warn":
alertify.set({ beforeCloseAction: action });
alertify.set({beforeCloseAction: action});
return alertify.log(txt);
case "info":
html = '<div id="fancyMsg" class="msgInfo">' + txt + '</div>';
@@ -1026,20 +1118,26 @@ function resMsg(type, txt, url, action) {
html = txt;
break;
case "nofancyerror":
html = '<P CLASS="error round">Oops...<BR />' + LANG[1] + '<BR />' + txt + '</P>';
html = '<p class="error round">Oops...<br>' + LANG[1] + '<br>' + txt + '</p>';
return html;
default:
alertify.set({ beforeCloseAction: action });
alertify.set({beforeCloseAction: action});
return alertify.error(txt);
}
$.fancybox(html, {afterLoad: function () {
$('.fancybox-skin,.fancybox-outer,.fancybox-inner').css({'border-radius': '25px', '-moz-border-radius': '25px', '-webkit-border-radius': '25px'});
}, afterClose: function () {
if (typeof action !== "undefined") {
eval(action);
$.fancybox(html, {
afterLoad: function () {
$('.fancybox-skin,.fancybox-outer,.fancybox-inner').css({
'border-radius': '25px',
'-moz-border-radius': '25px',
'-webkit-border-radius': '25px'
});
}, afterClose: function () {
if (typeof action !== "undefined") {
eval(action);
}
}
} });
});
}
// Función para comprobar la conexión con LDAP
@@ -1052,7 +1150,15 @@ function checkLdapConn() {
var ldapBindUser = $('#frmConfig').find('[name=ldap_binduser]').val();
var ldapBindPass = $('#frmConfig').find('[name=ldap_bindpass]').val();
var sk = $('#frmConfig').find('[name=sk]').val();
var data = {'ldap_server': ldapServer, 'ldap_base': ldapBase, 'ldap_group': ldapGroup, 'ldap_binduser': ldapBindUser, 'ldap_bindpass': ldapBindPass, 'isAjax': 1, 'sk': sk};
var data = {
'ldap_server': ldapServer,
'ldap_base': ldapBase,
'ldap_group': ldapGroup,
'ldap_binduser': ldapBindUser,
'ldap_bindpass': ldapBindPass,
'isAjax': 1,
'sk': sk
};
sendAjax(data, '/ajax/ajax_checkLdap.php');
}

4
js/jquery-1.11.2.min.js vendored Normal file

File diff suppressed because one or more lines are too long

2
js/jquery-migrate-1.2.1.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -27,7 +27,9 @@ define('APP_ROOT', '..');
require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'init.php';
$jsFiles = array(
array("href" => "js/jquery.js", "min" => false),
// array("href" => "js/jquery.js", "min" => false),
array("href" => "js/jquery-1.11.2.min.js", "min" => false),
array("href" => "js/jquery-migrate-1.2.1.min.js", "min" => false),
array("href" => "js/jquery.placeholder.js", "min" => true),
array("href" => "js/jquery-ui.js", "min" => false),
array("href" => "js/fancybox/jquery.fancybox.pack.js", "min" => false),
@@ -69,4 +71,4 @@ $arrJsLang = array(
echo "var LANG = ['" . implode("','", SP_Util::arrayJSEscape($arrJsLang)) . "'];";
echo "var APP_ROOT = '" . SP_Init::$WEBROOT . "';\n";
SP_Util::getMinified('js', $jsFiles);
SP_Util::getMinified('js', $jsFiles, true);