Hide password values from visible HTML in the Advanced Config page

Fixes issue #228
pull/240/head
luccioman 6 years ago
parent 75b9cd53cc
commit c409ec089c

@ -9,8 +9,15 @@
<script type="text/javascript"> <script type="text/javascript">
<!-- <!--
function element_clicked(element){ function element_clicked(element){
document.getElementById("key").value=element.id.substring(1); var key = element.id.substring(1);
document.getElementById("value").value=element.value; document.getElementById("key").value = key;
var valueField = document.getElementById("value");
if(key.endsWith("Password")) {
valueField.type = "password";
} else {
valueField.type = "text";
}
valueField.value=element.value;
} }
function filterList(){ function filterList(){
list=document.getElementsByName("options")[0]; list=document.getElementsByName("options")[0];
@ -51,7 +58,7 @@
</p> </p>
<select name="options" size="36" style="width: 600px"> <select name="options" size="36" style="width: 600px">
#{options}# #{options}#
<option id="k#[key]#" value="#[value]#" onclick="element_clicked(this)">#[key]#: #[value]#</option> <option id="k#[key]#" value="#[value]#" onclick="element_clicked(this)">#[key]#: #[visibleValue]#</option>
#{/options}# #{/options}#
</select><br /> </select><br />
<form action="ConfigProperties_p.html" method="post" accept-charset="UTF-8"> <form action="ConfigProperties_p.html" method="post" accept-charset="UTF-8">

@ -82,7 +82,11 @@ public class ConfigProperties_p {
// only display lines if they are no commment // only display lines if they are no commment
if (!key.startsWith("#")) { if (!key.startsWith("#")) {
prop.putHTML("options_" + count + "_key", key); prop.putHTML("options_" + count + "_key", key);
prop.putHTML("options_" + count + "_value", env.getConfig(key, "ERROR")); value = env.getConfig(key, "ERROR");
prop.putHTML("options_" + count + "_value", value);
/* Hide password values from visible text */
prop.putHTML("options_" + count + "_visibleValue",
key.endsWith("Password") ? value.replaceAll("\\S", "*") : value);
count++; count++;
} }
} }

Loading…
Cancel
Save