summaryrefslogtreecommitdiff
path: root/www/scripts/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'www/scripts/main.js')
-rw-r--r--www/scripts/main.js79
1 files changed, 70 insertions, 9 deletions
diff --git a/www/scripts/main.js b/www/scripts/main.js
index 79fb0b7..d989803 100644
--- a/www/scripts/main.js
+++ b/www/scripts/main.js
@@ -90,6 +90,18 @@ function IsEmpty(id)
return elem.value == "";
}
+function ShowPasswords()
+{
+ var elem = document.getElementById("ShowPasswords");
+
+ return elem.checked;
+}
+
+function SetInputType(id, type)
+{
+ document.getElementById(id).type = type;
+}
+
function LoadGroups(keep_selection)
{
globalGroups = [];
@@ -150,6 +162,7 @@ function AddTableInputCell(id, text, name, maxlen, classname, type, node)
input.id = name + id;
input.type = type;
input.maxLength = maxlen;
+ input.className = "fill";
td.className = classname;
@@ -225,10 +238,19 @@ function AddRow(table, id, prev_id, next_id, desc, username, password, rowcount)
tr.className = "style2";
}
- AddTableInputCell(id, desc, "Description", 1024, "description", "text", 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);
+
+ if (ShowPasswords())
+ {
+ AddTableInputCell(id, password, "Password", 256,
+ "password", "text", tr);
+ }
+ else
+ {
+ AddTableInputCell(id, password, "Password", 256,
+ "password", "password", tr);
+ }
var td = document.createElement("td");
@@ -512,21 +534,34 @@ function DoCopyUsername()
function DoCopyPassword()
{
var id = "Password" + this.dataset.pmId;
- document.getElementById(id).type = "text";
+
+ if (!ShowPasswords())
+ {
+ SetInputType(id, "text");
+ }
+
Copy(id);
- document.getElementById(id).type = "password";
+
+ if (!ShowPasswords())
+ {
+ SetInputType(id, "password");
+ }
}
function DoShow()
{
- var elem = document.getElementById("Password" + this.dataset.pmId);
- elem.type = "text";
+ if (!ShowPasswords())
+ {
+ SetInputType("Password" + this.dataset.pmId, "text");
+ }
}
function DoHide()
{
- var elem = document.getElementById("Password" + this.dataset.pmId);
- elem.type = "password";
+ if (!ShowPasswords())
+ {
+ SetInputType("Password" + this.dataset.pmId, "password");
+ }
}
function DoReorderAsync()
@@ -569,4 +604,30 @@ function DoDown()
);
}
+function DoShowPasswords()
+{
+ var type;
+
+ if (ShowPasswords())
+ {
+ type = "text";
+ }
+ else
+ {
+ type = "password";
+ }
+
+ SetInputType("PassPhrase", type);
+ SetInputType("Password-1", type);
+
+ var rows = GetGroupRows();
+ var f;
+
+ for(f = 0; f < rows.length;f++)
+ {
+ var id = "Password" + rows[f].id;
+ SetInputType(id, type);
+ }
+}
+
// vim: sw=4 ts=4