diff options
author | Jo-Philipp Wich <jo@mein.io> | 2018-07-23 14:30:03 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2018-07-23 14:30:03 +0200 |
commit | b6dd0ecd6cc7eb1f4c758a0815f725ff0be4f157 (patch) | |
tree | 754b06d1d92603d07c45c3a1900edae497ef04a1 /modules/luci-base/luasrc/view | |
parent | 7ba4eb1a42cb0baf3d0c66d16cfc5ce4d5f9709c (diff) |
luci-base: rework reveal/hide CBI password template button
Also add a hidden type password field to prevent browser autocompleters
from entering the login passwords into fields liek the wireless WPA key
field.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base/luasrc/view')
-rw-r--r-- | modules/luci-base/luasrc/view/cbi/value.htm | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/modules/luci-base/luasrc/view/cbi/value.htm b/modules/luci-base/luasrc/view/cbi/value.htm index c8c905eb1..942ab72e7 100644 --- a/modules/luci-base/luasrc/view/cbi/value.htm +++ b/modules/luci-base/luasrc/view/cbi/value.htm @@ -1,10 +1,16 @@ <%+cbi/valueheader%> + <%- if self.password then -%> + <input type="password" style="position:absolute; left:-1000px"<%= + attr("name", "password." .. cbid) + %> /> + <%- end -%> <input data-update="change"<%= attr("id", cbid) .. attr("name", cbid) .. attr("type", self.password and "password" or "text") .. attr("class", self.password and "cbi-input-password" or "cbi-input-text") .. attr("value", self:cfgvalue(section) or self.default) .. + ifattr(self.password, "autocomplete", "new-password") .. ifattr(self.size, "size") .. ifattr(self.placeholder, "placeholder") .. ifattr(self.readonly, "readonly") .. @@ -14,5 +20,7 @@ ifattr(self.combobox_manual, "data-manual", self.combobox_manual) .. ifattr(#self.keylist > 0, "data-choices", { self.keylist, self.vallist }) %> /> - <% if self.password then %><img src="<%=resource%>/cbi/reload.gif" style="vertical-align:middle" title="<%:Reveal/hide password%>" onclick="var e = document.getElementById('<%=cbid%>'); e.type = (e.type=='password') ? 'text' : 'password';" /><% end %> + <%- if self.password then -%> + <div class="cbi-button cbi-button-neutral" title="<%:Reveal/hide password%>" onclick="var e = this.previousElementSibling; e.type = (e.type === 'password') ? 'text' : 'password'">∗</div> + <% end %> <%+cbi/valuefooter%> |