Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

Hide password values from visible HTML in the Advanced Config page

lucciomanc409ec089c39
diff --git a/htroot/ConfigProperties_p.html b/htroot/ConfigProperties_p.html
index ed1bc4333..fbaf4ae33 100644
--- a/htroot/ConfigProperties_p.html
+++ b/htroot/ConfigProperties_p.html
@@ -9,8 +9,15 @@
<script type="text/javascript">
<!--
function element_clicked(element){
- document.getElementById("key").value=element.id.substring(1);
- document.getElementById("value").value=element.value;
+ var key = element.id.substring(1);
+ 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(){
list=document.getElementsByName("options")[0];
@@ -51,7 +58,7 @@
</p>
<select name="options" size="36" style="width: 600px">
#{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}#
</select><br />
<form action="ConfigProperties_p.html" method="post" accept-charset="UTF-8">
diff --git a/htroot/ConfigProperties_p.java b/htroot/ConfigProperties_p.java
index 39e262a7b..4474b8ddb 100644
--- a/htroot/ConfigProperties_p.java
+++ b/htroot/ConfigProperties_p.java
@@ -82,7 +82,11 @@ public class ConfigProperties_p {
// only display lines if they are no commment
if (!key.startsWith("#")) {
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++;
}
}