From 58c1910669b62d8474f680c9ede72abd07f047b9 Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Thu, 25 Apr 2024 08:49:41 +0200 Subject: [PATCH] #13085 hide password value in ldap --- pandora_console/godmode/setup/setup_auth.php | 10 +- pandora_console/include/functions_config.php | 6 +- pandora_console/include/functions_html.php | 58 ++++- pandora_console/include/styles/pandora.css | 239 +++++++++++++++++++ 4 files changed, 300 insertions(+), 13 deletions(-) diff --git a/pandora_console/godmode/setup/setup_auth.php b/pandora_console/godmode/setup/setup_auth.php index df4d75d6aa..e17d13806f 100644 --- a/pandora_console/godmode/setup/setup_auth.php +++ b/pandora_console/godmode/setup/setup_auth.php @@ -196,14 +196,20 @@ if (is_ajax() === true) { $row['name'] = __('Admin LDAP password'); $row['control'] = html_print_input_password( 'ldap_admin_pass', - io_output_password($config['ldap_admin_pass']), + (empty(io_output_password($config['ldap_admin_pass'])) === false) ? '*****' : '', $alt = '', 60, 100, true, false, false, - 'w400px-important' + 'w400px-important', + 'on', + false, + '', + true, + false, + true ); $table->data['ldap_admin_pass'] = $row; diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 2cfa515259..29b7cff6a5 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -710,8 +710,10 @@ function config_update_config() $error_update[] = __('Admin LDAP login'); } - if (config_update_value('ldap_admin_pass', get_parameter('ldap_admin_pass'), true, true) === false) { - $error_update[] = __('Admin LDAP password'); + if ((bool) get_parameter('ldap_admin_pass_password_changed', false) === true) { + if (config_update_value('ldap_admin_pass', get_parameter('ldap_admin_pass'), true, true) === false) { + $error_update[] = __('Admin LDAP password'); + } } if (config_update_value('ldap_search_timeout', (int) get_parameter('ldap_search_timeout', 5), true) === false) { diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 7f4033ab53..69084f4dde 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -2964,13 +2964,19 @@ function html_print_anchor( * * The element will have an id like: "password-$name" * - * @param string $name Input name. - * @param string $value Input value. - * @param string $alt Alternative HTML string (optional). - * @param integer $size Size of the input (optional). - * @param integer $maxlength Maximum length allowed (optional). - * @param boolean $return Whether to return an output string or echo now (optional, echo by default). - * @param boolean $disabled Disable the button (optional, button enabled by default). + * @param string $name Input name. + * @param string $value Input value. + * @param string $alt Alternative HTML string (optional). + * @param integer $size Size of the input (optional). + * @param integer $maxlength Maximum length allowed (optional). + * @param boolean $return Whether to return an output string or echo now (optional, echo by default). + * @param boolean $disabled Disable the button (optional, button enabled by default). + * @param boolean $required Whether the input is required (optional, not required by default). + * @param string $class Additional CSS classes for the input (optional). + * @param string $autocomplete Autocomplete attribute value (optional, off by default). + * @param boolean $hide_div_eye Whether to hide the div with the eye icon (optional, false by default). + * @param string $div_class Additional CSS classes for the div (optional). + * @param boolean $not_show_value Whether to not show the value in the input (optional, false by default), FOR USE THIS VALUE YOU NEED CONTROL THE INPUT 'password_changed'. * * @return string HTML code if return parameter is true. */ @@ -2986,7 +2992,8 @@ function html_print_input_password( $class='', $autocomplete='off', $hide_div_eye=false, - $div_class='' + $div_class='', + $not_show_value=false, ) { if ($maxlength == 0) { $maxlength = 255; @@ -3017,7 +3024,40 @@ function html_print_input_password( } } - return '
'.html_print_input_text_extended($name, $value, 'password-'.$name, $alt, $size, $maxlength, $disabled, '', $attr, $return, true, '', $autocomplete, false, $hide_div_eye).'
'; + $extra_output = ''; + if ($not_show_value === true) { + $unique_id = 'flag_password_'.uniqid(); + $extra_output = html_print_input_hidden($name.'_password_changed', 0, true, false, false, $unique_id); + $attr['class'] .= ' bg-image-none'; + $extra_output .= ''; + } + + return '
'.html_print_input_text_extended($name, $value, 'password-'.$name, $alt, $size, $maxlength, $disabled, '', $attr, $return, true, '', $autocomplete, false, $hide_div_eye).'
'.$extra_output; } diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 1e2df92ba7..b6a3744f53 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -13809,3 +13809,242 @@ button.disabled { margin-top: 10px; padding-top: 15px; } + +.menu-dots-hide { + display: none; +} + +.menu-dots-show { + display: list-item; +} + +.tabs-hide { + display: none; +} + +.tabs-show { + display: list-item; +} + +.white_table_graph > div { + background-color: transparent; + border-radius: 8px; +} + +.link-bold { + color: var(--primary-color); + text-decoration: none; + font-weight: bold; +} + +.link-bold:hover { + opacity: 0.9; + color: var(--primary-color); +} + +.text-nowrap { + text-wrap: nowrap; +} + +#wizard_table span#image_prev img { + height: 48px; + cursor: pointer; +} + +.empty-view { + width: 100%; + max-width: 1000px; + background-color: #95a3bf0d; + border-radius: 8px; + margin: 0 auto; + margin-bottom: 25px; +} + +.empty-view > .empty-view-img-text { + display: flex; + flex-direction: row; + flex-wrap: nowrap; + align-items: flex-start; + padding: 30px; +} + +.empty-view-text { + margin-left: 40px; +} + +.empty-view-text > span:nth-child(1) { + display: block; + color: var(--text-color-2); + font-weight: bold; + font-size: 16px; + line-height: 24px; + margin-bottom: 10px; +} + +.empty-view-text > span:nth-child(2), +.empty-view-text > span:nth-child(2) * { + color: var(--text-color-3); + font-size: 15px; + line-height: 24px; +} + +.empty-view-buttons { + display: flex; + flex-direction: row; + flex-wrap: nowrap; + justify-content: flex-end; + align-items: center; + width: 100%; + border-top: 1px solid; + border-color: #95a3bf33; +} + +.empty-view-buttons > * { + margin: 10px; +} + +.empty-view-buttons > *:not(:last-child) { + margin-right: 0; +} + +form#submit-plugin { + display: flex; + flex-direction: row; + flex-wrap: nowrap; + justify-content: flex-end; + align-items: center; + width: 100%; + gap: 15px; +} + +form#submit-plugin > input[type="file"] { + line-height: 34px; + padding-top: 0; +} + +form#aws-view > span.select2 { + vertical-align: bottom; + margin-right: 15px; +} + +table#snmp_console tbody td:not(.table_action_buttons) * { + height: 100%; + display: flex; + align-items: center; +} + +table#snmp_console tbody .datos_green, +table#snmp_console tbody .datos_green * { + background-color: var(--events-priority-bg-green); + color: var(--events-priority-text-green) !important; +} + +table#snmp_console tbody .datos_red, +table#snmp_console tbody .datos_red * { + background-color: var(--events-priority-bg-red); + color: var(--events-priority-text-red) !important; +} + +table#snmp_console tbody .datos_yellow, +table#snmp_console tbody .datos_yellow * { + background-color: var(--events-priority-bg-yellow); + color: var(--events-priority-text-yellow) !important; +} + +table#snmp_console tbody .datos_blue, +table#snmp_console tbody .datos_blue * { + background-color: var(--events-priority-bg-blue); + color: var(--events-priority-text-blue) !important; +} + +table#snmp_console tbody .datos_grey, +table#snmp_console tbody .datos_grey * { + background-color: var(--events-priority-bg-grey); + color: var(--events-priority-text-grey) !important; +} + +table#snmp_console tbody .datos_pink, +table#snmp_console tbody .datos_pink * { + background-color: var(--events-priority-bg-pink); + color: var(--events-priority-text-pink) !important; +} + +table#snmp_console tbody .datos_brown, +table#snmp_console tbody .datos_brown * { + background-color: var(--events-priority-bg-brown); + color: var(--events-priority-text-brown) !important; +} + +table#snmp_console tbody .datos_orange, +table#snmp_console tbody .datos_orange * { + background-color: var(--events-priority-bg-orange); + color: var(--events-priority-text-orange) !important; +} + +.open_search_status_color { + color: var(--text-color-2); +} + +button.ui-button-text-only.ui-widget.sub:hover, +#button_generate_code input.buttonButton:hover { + box-shadow: 0px 3px 6px #c7c7c7; +} + +#button_generate_code input.buttonButton { + box-shadow: none; +} + +.black-and-white { + filter: saturate(0); +} + +.invert_filter.black-and-white { + filter: invert(1) saturate(0) !important; +} + +div.tox .tox-editor-header { + z-index: 1; +} + +.select2-multiselect-widget-width { + max-width: 230px !important; +} + +.select2-container--default.select2-multiselect-text-wrap + .select2-selection--multiple + .select2-selection__rendered { + box-sizing: border-box !important; + padding-right: 0px !important; +} + +.select2-multiselect-text-wrap .select2-selection__choice { + text-wrap: wrap; + line-break: anywhere; + line-height: normal; +} + +.select2-multiselect-text-wrap .select2-selection__choice__remove { + flex-basis: 0% !important; +} + +table.filter-table-adv td > div.row-flex { + flex-direction: row; + align-items: center; + justify-content: space-between; +} + +table.filter-table-adv td > div.row-flex.flex-end { + justify-content: flex-end; +} + +table.filter-table-adv td > div.row-flex label.custom_checkbox { + margin: 0px; +} + +table.filter-table-adv td > div.row-flex input { + width: 100%; +} + +.bg-image-none { + background-image: none !important; +}