Added control for reveal passwords
This commit is contained in:
parent
8df5fab69f
commit
6a21a668bf
|
@ -124,7 +124,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');
|
||||
|
@ -162,7 +163,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);
|
||||
|
@ -384,6 +386,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();
|
||||
|
||||
|
|
|
@ -6124,3 +6124,23 @@ 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)
|
||||
{
|
||||
$output = ' <img class="clickable forced_title" id="reveal_password_'.$name.'" src="images/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;
|
||||
}
|
||||
|
|
|
@ -552,3 +552,16 @@ function infoMessage(data, idMsg) {
|
|||
})
|
||||
.show();
|
||||
}
|
||||
|
||||
function reveal_password(name) {
|
||||
var passwordElement = $("#password-" + name);
|
||||
var revealElement = $("#reveal_password_" + name);
|
||||
|
||||
if (passwordElement.attr("type") == "password") {
|
||||
passwordElement.attr("type", "text");
|
||||
revealElement.attr("src", "images/eye_hide.png");
|
||||
} else {
|
||||
passwordElement.attr("type", "password");
|
||||
revealElement.attr("src", "images/eye_show.png");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue