Merge branch 'ent-13085-17271-cifrado-de-contrasena-ldap-en-el-inspector' into 'develop'

Ent 13085 17271 cifrado de contrasena ldap en el inspector

See merge request 
This commit is contained in:
Daniel Rodriguez 2024-04-29 09:34:23 +00:00
commit be184c9a3c
4 changed files with 65 additions and 13 deletions

@ -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;

@ -703,8 +703,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) {

@ -3490,13 +3490,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.
*/
@ -3512,7 +3518,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;
@ -3543,7 +3550,40 @@ function html_print_input_password(
}
}
return '<div class="relative container-div-input-password '.$div_class.'">'.html_print_input_text_extended($name, $value, 'password-'.$name, $alt, $size, $maxlength, $disabled, '', $attr, $return, true, '', $autocomplete, false, $hide_div_eye).'</div>';
$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 .= '<script>
$("#show-hide-password-'.$name.'").hide();
const exist_'.$unique_id.' = '.((empty($value) === false) ? 'true' : 'false').';
$("#password-'.$name.'").on("focus", function(e) {
if ($("#'.$unique_id.'").val() === "0") {
$(this).val("");
}
});
$("#password-'.$name.'").on("focusout", function(e) {
if ($("#'.$unique_id.'").val() === "0" && $(this).val() === "" && exist_'.$unique_id.' === true) {
$(this).val("*****");
}
});
$("#password-'.$name.'").on("keyup", function(e) {
$("#'.$unique_id.'").val(1);
if ($(this).val() === "") {
$(this).addClass("bg-image-none");
$("#show-hide-password-'.$name.'").hide();
} else {
$(this).removeClass("bg-image-none");
$("#show-hide-password-'.$name.'").show();
}
});
</script>';
}
return '<div class="relative container-div-input-password '.$div_class.'">'.html_print_input_text_extended($name, $value, 'password-'.$name, $alt, $size, $maxlength, $disabled, '', $attr, $return, true, '', $autocomplete, false, $hide_div_eye).'</div>'.$extra_output;
}

@ -14307,3 +14307,7 @@ div.fixed-bottom-box.tree-view-bottom-modal {
.custom-graph-editor-agents-module-filter > span.select2.select2-container {
height: 189px;
}
.bg-image-none {
background-image: none !important;
}