diff --git a/ajax/ajax_configSave.php b/ajax/ajax_configSave.php
index f853a6a2..09ec77b6 100644
--- a/ajax/ajax_configSave.php
+++ b/ajax/ajax_configSave.php
@@ -79,11 +79,13 @@ if ($actionId === SP\Controller\ActionsInterface::ACTION_CFG_GENERAL
// Accounts
$globalSearchEnabled = SP\Request::analyze('globalsearch', false, false, true);
+ $accountPassToImageEnabled = SP\Request::analyze('account_passtoimage', false, false, true);
$accountLinkEnabled = SP\Request::analyze('account_link', false, false, true);
$accountCount = SP\Request::analyze('account_count', 10);
$resultsAsCardsEnabled = SP\Request::analyze('resultsascards', false, false, true);
SP\Config::setValue('globalsearch', $globalSearchEnabled);
+ SP\Config::setValue('account_passtoimage', $accountPassToImageEnabled);
SP\Config::setValue('account_link', $accountLinkEnabled);
SP\Config::setValue('account_count', $accountCount);
SP\Config::setValue('resultsascards', $resultsAsCardsEnabled);
diff --git a/ajax/ajax_viewpass.php b/ajax/ajax_viewpass.php
index 19a8cb24..435d1f0f 100644
--- a/ajax/ajax_viewpass.php
+++ b/ajax/ajax_viewpass.php
@@ -74,10 +74,13 @@ if (!$isHistory) {
//$accountPass = htmlspecialchars(trim($accountClearPass));
+$useImage = intval(\SP\Util::accountPassToImageIsEnabled());
+
$data = array(
'title' => _('Clave de Cuenta'),
'acclogin' => $accountData->login,
- 'accpass' => trim($accountClearPass)
+ 'accpass' => (!$useImage) ? trim($accountClearPass) : \SP\ImageUtil::convertText($accountClearPass),
+ 'useimage' => $useImage
);
SP\Common::printJSON($data, 0);
\ No newline at end of file
diff --git a/imgs/NotoSansUI-Regular.ttf b/imgs/NotoSansUI-Regular.ttf
new file mode 100644
index 00000000..72709786
Binary files /dev/null and b/imgs/NotoSansUI-Regular.ttf differ
diff --git a/inc/ImageUtil.class.php b/inc/ImageUtil.class.php
new file mode 100644
index 00000000..f9d28a5a
--- /dev/null
+++ b/inc/ImageUtil.class.php
@@ -0,0 +1,77 @@
+.
+ *
+ */
+
+namespace SP;
+
+defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo'));
+
+/**
+ * Class ImageUtil para la manipulación de imágenes
+ *
+ * @package SP
+ */
+class ImageUtil
+{
+ /**
+ * Convertir un texto a imagen
+ *
+ * @param $text string El texto a convertir
+ * @return bool|string
+ */
+ public static function convertText($text)
+ {
+ if(!function_exists('imagepng')){
+ return false;
+ }
+
+ $im = imagecreatetruecolor(strlen($text) * 20, 30);
+
+ // Colores de la imagen
+ $bgColor = imagecolorallocate($im, 255, 255, 255);
+// $shadowColor = imagecolorallocate($im, 128, 128, 128);
+ $fgColor = imagecolorallocate($im, 128, 128, 128);
+
+ imagefilledrectangle($im, 0, 0, strlen($text) * 20, 29, $bgColor);
+
+ // Ruta de la fuente
+ $font = Init::$SERVERROOT . '/imgs/NotoSansUI-Regular.ttf';
+
+ // Sombra
+// imagettftext($im, 14, 0, 13, 23, $shadowColor, $font, $text);
+
+ // Crear el texto
+ imagettftext($im, 12, 0, 10, 20, $fgColor, $font, $text);
+
+ // Guardar la imagen
+ ob_start();
+ imagepng($im);
+ $image = ob_get_contents();
+ ob_end_clean();
+
+ imagedestroy($im);
+
+ return base64_encode($image);
+ }
+}
\ No newline at end of file
diff --git a/inc/Util.class.php b/inc/Util.class.php
index b4537b03..5e22eae2 100644
--- a/inc/Util.class.php
+++ b/inc/Util.class.php
@@ -444,6 +444,16 @@ class Util
return self::boolval(Config::getValue('resultsascards', false));
}
+ /**
+ * Comprobar si está habilitado usar imagen para claves de cuentas
+ *
+ * @return bool
+ */
+ public static function accountPassToImageIsEnabled()
+ {
+ return self::boolval(Config::getValue('account_passtoimage', false));
+ }
+
/**
* Establecer variable de sesión para recargar la aplicación.
*/
diff --git a/inc/themes/classic/account.inc b/inc/themes/classic/account.inc
index b77f1dde..e3c8fdd9 100644
--- a/inc/themes/classic/account.inc
+++ b/inc/themes/classic/account.inc
@@ -348,11 +348,13 @@
+
+
diff --git a/inc/themes/classic/config.inc b/inc/themes/classic/config.inc
index e7404a1b..8e4dcc1a 100644
--- a/inc/themes/classic/config.inc
+++ b/inc/themes/classic/config.inc
@@ -222,6 +222,25 @@
class="checkbox" />
+
+
+
+
+
+ |
+
+
+ />
+ |
+
diff --git a/inc/themes/classic/js/functions.js b/inc/themes/classic/js/functions.js
index 5351cca9..5962d766 100644
--- a/inc/themes/classic/js/functions.js
+++ b/inc/themes/classic/js/functions.js
@@ -37,7 +37,9 @@ jQuery.extend(jQuery.fancybox.defaults, {
$(document).ready(function () {
"use strict";
- $('input[type="text"], select, textarea').placeholder().mouseenter(function () {$(this).focus();});
+ $('input[type="text"], select, textarea').placeholder().mouseenter(function () {
+ $(this).focus();
+ });
setContentSize();
setWindowAdjustSize();
@@ -48,14 +50,16 @@ $(document).ready(function () {
}).ajaxComplete(function () {
"use strict";
- $('input[type="text"], select, textarea').placeholder().mouseenter(function () {$(this).focus();});
+ $('input[type="text"], select, textarea').placeholder().mouseenter(function () {
+ $(this).focus();
+ });
// Activar tooltips
activeTooltip();
});
-function activeTooltip(){
+function activeTooltip() {
"use strict";
// Activar tooltips
@@ -67,7 +71,7 @@ function activeTooltip(){
});
$('.help-tooltip').tooltip({
- content: function(){
+ content: function () {
return $(this).next('div').html();
},
tooltipClass: "tooltip"
@@ -321,16 +325,28 @@ function viewPass(id, full, history) {
width: 'auto',
open: function () {
var content;
+ var pass = '';
+ var clipboardUserButton =
+ '';
+ var clipboardPassButton =
+ '';
+ var useImage = json.useimage;
if (json.status === 0) {
- content = '' + json.accpass + '
' +
- '
' +
- '' +
- '' +
- '
';
+ if (useImage === 0) {
+ pass = '' + json.accpass + '
';
+ } else {
+ pass = '
';
+ clipboardPassButton = '';
+ }
+
+ content = pass + '
' + '' + clipboardUserButton + clipboardPassButton + '
';
} else {
content = '' + json.description + '';
@@ -350,26 +366,34 @@ function viewPass(id, full, history) {
$(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"});
+ var clientPass = new ZeroClipboard($("#dialog-clip-pass-button-" + id), {swfPath: APP_ROOT + "/js/ZeroClipboard.swf"});
+ var clientUser = new ZeroClipboard($("#dialog-clip-user-button-" + id), {swfPath: APP_ROOT + "/js/ZeroClipboard.swf"});
- client.on('ready', function (e) {
+ clientPass.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);
+ clientPass.on('copy', function (e) {
+ //e.clipboardData.setData('text/plain', json.accpass);
+ clientPass.setText(json.accpass);
});
- client.on('aftercopy', function (e) {
+ clientPass.on('aftercopy', function (e) {
$('.dialog-pass-text').addClass('dialog-clip-pass-copy round');
});
});
- client.on('error', function (e) {
+
+ clientPass.on('error', function (e) {
ZeroClipboard.destroy();
});
+ clientUser.on('ready', function (e) {
+ clientUser.on('copy', function (e) {
+ clientUser.setText(json.acclogin);
+ });
+ });
+
// Timeout del mensaje
- var $this = $(this);
+ var thisDialog = $(this);
timeout = setTimeout(function () {
- $this.dialog('close');
+ thisDialog.dialog('close');
}, 30000);
},
// Forzar la eliminación del objeto para que ZeroClipboard siga funcionando al abrirlo de nuevo
@@ -1149,21 +1173,21 @@ function complexityDialog(targetId) {
$('').dialog({
modal: true,
title: 'Opciones de Complejidad',
- width: '400px',
+ width: '450px',
open: function () {
var thisDialog = $(this);
var content =
'' +
- '' +
+ '' +
'' +
- '' +
+ '' +
'' +
- '' +
+ '' +
'' +
'
' +
'' +
- '' +
+ '' +
'' +
'
' +
'
+
+ |
+
+ help_outline
+
+ |
+
+
+ |
+
diff --git a/inc/themes/material-blue/js/functions.js b/inc/themes/material-blue/js/functions.js
index 2fdb134d..6b2095fe 100644
--- a/inc/themes/material-blue/js/functions.js
+++ b/inc/themes/material-blue/js/functions.js
@@ -316,20 +316,28 @@ function viewPass(id, full, history) {
width: 'auto',
open: function () {
var content;
+ var pass = '';
+ var clipboardUserButton =
+ '
';
+ var clipboardPassButton =
+ '
';
+ var useImage = json.useimage;
if (json.status === 0) {
- content = '
' + json.accpass + '
' +
- '
' +
- '
' +
- '' +
- '' +
- '
';
+ if (useImage === 0) {
+ pass = '
' + json.accpass + '
';
+ } else {
+ pass = '

';
+ clipboardPassButton = '';
+ }
+
+ content = pass + '
' + '
' + clipboardUserButton + clipboardPassButton + '
';
} else {
content = '
' + json.description + '';
@@ -373,14 +381,13 @@ function viewPass(id, full, history) {
});
});
-
// Cerrar Dialog a los 30s
- var $this = $(this);
+ var thisDialog = $(this);
$(this).parent().on('mouseleave', function () {
clearTimeout(timeout);
timeout = setTimeout(function () {
- $this.dialog('close');
+ thisDialog.dialog('close');
}, 30000);
});
},
@@ -1187,19 +1194,19 @@ function complexityDialog() {
var content =
'
' +
'
' +
'
' +
'
' +
'' +
- '' +
+ '' +
'
' +
'
';
diff --git a/inc/themes/material-blue/search.inc b/inc/themes/material-blue/search.inc
index 06ccfaf0..93aac020 100644
--- a/inc/themes/material-blue/search.inc
+++ b/inc/themes/material-blue/search.inc
@@ -112,10 +112,12 @@
lock_open
+
content_paste
+
diff --git a/js/strings.js.php b/js/strings.js.php
index 0283f0b3..14ff3d5c 100644
--- a/js/strings.js.php
+++ b/js/strings.js.php
@@ -56,7 +56,13 @@ $stringsJsLang = array(
29 => _('Complejidad'),
30 => _('Reset'),
31 => _('Nivel de fortaleza de la clave'),
- 32 => _('Mostrar Clave')
+ 32 => _('Mostrar Clave'),
+ 33 => _('Copiar Usuario'),
+ 34 => _('Copiar Clave'),
+ 35 => _('Incluir Números'),
+ 36 => _('Incluir Mayúsculas'),
+ 37 => _('Incluir Símbolos'),
+ 38 => _('Longitud'),
);
diff --git a/web/ConfigC.class.php b/web/ConfigC.class.php
index c230c57f..703a796d 100644
--- a/web/ConfigC.class.php
+++ b/web/ConfigC.class.php
@@ -104,6 +104,7 @@ class ConfigC extends Controller implements ActionsInterface
// Accounts
$this->view->assign('chkGlobalSearch', (\SP\Config::getValue('globalsearch')) ? 'checked="checked"' : '');
$this->view->assign('chkResultsAsCards', (\SP\Config::getValue('resultsascards')) ? 'checked="checked"' : '');
+ $this->view->assign('chkAccountPassToImage', (\SP\Config::getValue('account_passtoimage')) ? 'checked="checked"' : '');
$this->view->assign('chkAccountLink', (\SP\Config::getValue('account_link')) ? 'checked="checked"' : '');
$this->view->assign('accountCount', \SP\Config::getValue('account_count'));