summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2018-06-27 15:05:26 +0000
committerIan C <ianc@noddybox.co.uk>2018-06-27 15:05:26 +0000
commitd750c1a34d4c344154cd0abaa3aa6e9021335318 (patch)
treeba633817b47cc6a1153e54b0d952a65c6f366043
parentaa9788530bb4b28931da9a39cb46add4bca51ce0 (diff)
Made password column masked and added a command to show the password.
-rw-r--r--INSTRUCTIONS2
-rw-r--r--www/scripts/main.js42
2 files changed, 39 insertions, 5 deletions
diff --git a/INSTRUCTIONS b/INSTRUCTIONS
index 8bd6260..1332305 100644
--- a/INSTRUCTIONS
+++ b/INSTRUCTIONS
@@ -18,3 +18,5 @@ To delete an existing record simply hit the Delete link.
The Copy Username and Copy Password links can be used to copy the username or
password respectively to the clipboard.
+
+The Show link can be used to reveal the password while the button is down.
diff --git a/www/scripts/main.js b/www/scripts/main.js
index 1528c2c..0ed2cf5 100644
--- a/www/scripts/main.js
+++ b/www/scripts/main.js
@@ -141,14 +141,14 @@ function LoadGroups(keep_selection)
elem.value = globalCurrentGroup;
}
-function AddTableInputCell(id, text, name, maxlen, classname, node)
+function AddTableInputCell(id, text, name, maxlen, classname, type, node)
{
var td = document.createElement("td");
var input = document.createElement("input");
input.value = text;
input.id = name + id;
- input.type = "text";
+ input.type = type;
input.maxLength = maxlen;
td.className = classname;
@@ -170,6 +170,20 @@ function AddSmallLink(node, text, func, id)
node.appendChild(anchor);
}
+function AddSmallLinkUpDown(node, text, down_func, up_func, id)
+{
+ var anchor = document.createElement("a");
+
+ anchor.href = "#";
+ anchor.onmousedown = down_func;
+ anchor.onmouseup = up_func;
+ anchor.text = text;
+ anchor.className = "smalltext";
+ anchor.dataset.pmId = id;
+
+ node.appendChild(anchor);
+}
+
function AddText(node, text)
{
var t = document.createTextNode(text);
@@ -196,9 +210,10 @@ function AddRow(table, id, desc, username, password, rowcount)
tr.className = "style2";
}
- AddTableInputCell(id, desc, "Description", 1024, "description", tr);
- AddTableInputCell(id, username, "Username", 256, "username", tr);
- AddTableInputCell(id, password, "Password", 256, "password", tr);
+ AddTableInputCell(id, desc, "Description", 1024, "description", "text", tr);
+ AddTableInputCell(id, username, "Username", 256, "username", "text", tr);
+ AddTableInputCell(id, password, "Password", 256,
+ "password", "password", tr);
var td = document.createElement("td");
@@ -214,6 +229,9 @@ function AddRow(table, id, desc, username, password, rowcount)
AddText(td, "\u00a0");
AddText(td, "\u00a0");
AddSmallLink(td, "Delete", DoDelete, id);
+ AddText(td, "\u00a0");
+ AddText(td, "\u00a0");
+ AddSmallLinkUpDown(td, "Show", DoShow, DoHide, id);
AddElement(td, "br");
AddSmallLink(td, "Copy Username", DoCopyUsername, id);
AddText(td, "\u00a0");
@@ -431,7 +449,21 @@ function DoCopyUsername()
function DoCopyPassword()
{
var id = "Password" + this.dataset.pmId;
+ document.getElementById(id).type = "text";
Copy(id);
+ document.getElementById(id).type = "password";
+}
+
+function DoShow()
+{
+ var elem = document.getElementById("Password" + this.dataset.pmId);
+ elem.type = "text";
+}
+
+function DoHide()
+{
+ var elem = document.getElementById("Password" + this.dataset.pmId);
+ elem.type = "password";
}
// vim: sw=4 ts=4