Merge branch 'ent-6398-Poner-ojito-mostrar-passwords' into 'develop'

Ent 6398 poner ojito mostrar passwords

Closes pandora_enterprise#6398

See merge request artica/pandorafms!3488
This commit is contained in:
Daniel Rodriguez 2020-11-23 16:17:35 +01:00
commit 2718558b29
9 changed files with 117 additions and 2 deletions

View File

@ -468,6 +468,7 @@ function quickShellSettings()
100,
true
);
$hidden->data[1][1] .= ui_print_reveal_password('gotty_pass', true);
html_print_table($t);

View File

@ -189,6 +189,10 @@ if (is_ajax()) {
100,
true
);
$row['control'] .= ui_print_reveal_password(
'ldap_admin_pass',
true
);
$table->data['ldap_admin_pass'] = $row;
break;

View File

@ -82,6 +82,7 @@ $table_remote->data['ehorus_user'] = $row;
$row = [];
$row['name'] = __('Password');
$row['control'] = html_print_input_password('ehorus_pass', io_output_password($config['ehorus_pass']), '', 30, 100, true);
$row['control'] .= ui_print_reveal_password('ehorus_pass', true);
$table_remote->data['ehorus_pass'] = $row;
// Directory hostname.

View File

@ -116,7 +116,8 @@ $table->data[$i][0] = __('Phantomjs bin directory');
$table->data[$i++][1] = html_print_input_text('phantomjs_bin', io_safe_output($config['phantomjs_bin']), '', 30, 100, true);
$table->data[$i][0] = __('Auto login (hash) password');
$table->data[$i++][1] = html_print_input_password('loginhash_pwd', io_output_password($config['loginhash_pwd']), '', 15, 15, true);
$table->data[$i][1] = html_print_input_password('loginhash_pwd', io_output_password($config['loginhash_pwd']), '', 15, 15, true);
$table->data[$i++][1] .= ui_print_reveal_password('loginhash_pwd', true);
$table->data[$i][0] = __('Time source');
$sources['system'] = __('System');
@ -154,7 +155,8 @@ if (isset($_POST['list_ACL_IPs_for_API'])) {
$table->data[$i++][1] = html_print_textarea('list_ACL_IPs_for_API', 2, 25, $list_ACL_IPs_for_API, 'style="height: 50px; width: 300px"', true);
$table->data[$i][0] = __('API password');
$table->data[$i++][1] = html_print_input_password('api_password', io_output_password($config['api_password']), '', 25, 255, true);
$table->data[$i][1] = html_print_input_password('api_password', io_output_password($config['api_password']), '', 25, 255, true);
$table->data[$i++][1] .= ui_print_reveal_password('api_password', true);
$table->data[$i][0] = __('Enable GIS features');
$table->data[$i++][1] = html_print_checkbox_switch('activate_gis', 1, $config['activate_gis'], true);
@ -379,6 +381,7 @@ $table_mail_conf->data[5][1] = html_print_input_text('email_username', $config['
$table_mail_conf->data[6][0] = __('Email password');
$table_mail_conf->data[6][1] = html_print_input_password('email_password', io_output_password($config['email_password']), '', 30, 100, true);
$table_mail_conf->data[6][1] .= ui_print_reveal_password('email_password', true);
$uniqid = uniqid();

View File

@ -221,6 +221,7 @@ $table_remote->data['integria_user'] = $row;
$row = [];
$row['name'] = __('Password');
$row['control'] = html_print_input_password('integria_pass', io_output_password($config['integria_pass']), '', 30, 100, true);
$row['control'] .= ui_print_reveal_password('integria_pass', true);
$table_remote->data['integria_pass'] = $row;
// Integria hostname.
@ -233,6 +234,7 @@ $table_remote->data['integria_hostname'] = $row;
$row = [];
$row['name'] = __('API Password');
$row['control'] = html_print_input_password('integria_api_pass', io_output_password($config['integria_api_pass']), '', 30, 100, true);
$row['control'] .= ui_print_reveal_password('integria_api_pass', true);
$table_remote->data['integria_api_pass'] = $row;
// Request timeout.

Binary file not shown.

After

Width:  |  Height:  |  Size: 647 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -6132,3 +6132,29 @@ function ui_print_message_dialog($title, $text, $id='', $img='', $text_button=''
echo '</div>';
echo '</div>';
}
/**
* Generate a button for reveal the content of the password field.
*
* @param string $name Name of the field.
* @param boolean $return If true, return the string with the formed element.
*
* @return string
*/
function ui_print_reveal_password(string $name, bool $return=false)
{
if (is_metaconsole()) {
$imagePath = '../../images/';
} else {
$imagePath = 'images/';
}
$output = '&nbsp;<img class="clickable forced_title" id="reveal_password_'.$name.'" src="'.$imagePath.'eye_show.png" onclick="reveal_password(\''.$name.'\')" data-use_title_for_force_title="1" data-title="'.__('Show password').'">';
if ($return === true) {
return $output;
}
echo $output;
}

View File

@ -494,3 +494,81 @@ function generalShowMsg(data, idMsg) {
]
});
}
function infoMessage(data, idMsg) {
var title = data.title;
var err_messge = data.text;
if (idMsg == null) {
idMsg = uniqId();
}
if ($("#" + idMsg).length === 0) {
$("body").append('<div title="' + title + '" id="' + idMsg + '"></div>');
$("#" + idMsg).empty();
}
$("#err_msg").empty();
$("#err_msg").html("\n\n" + err_messge);
$("#" + idMsg)
.dialog({
height: 250,
width: 528,
opacity: 1,
modal: true,
position: {
my: "center",
at: "center",
of: window,
collision: "fit"
},
title: data.title,
buttons: [
{
class:
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next",
text: "Retry",
click: function(e) {
handleConnection();
}
},
{
class:
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-cancel",
text: "Close",
click: function() {
$(this).dialog("close");
}
}
],
open: function(event, ui) {
$(".ui-widget-overlay").addClass("error-modal-opened");
},
close: function(event, ui) {
$(".ui-widget-overlay").removeClass("error-modal-opened");
}
})
.show();
}
function reveal_password(name) {
var passwordElement = $("#password-" + name);
var revealElement = $("#reveal_password_" + name);
var imagesPath = "";
if ($("#hidden-metaconsole_activated").val() == 1) {
imagesPath = "../../images/";
} else {
imagesPath = "images/";
}
if (passwordElement.attr("type") == "password") {
passwordElement.attr("type", "text");
revealElement.attr("src", imagesPath + "eye_hide.png");
} else {
passwordElement.attr("type", "password");
revealElement.attr("src", imagesPath + "eye_show.png");
}
}