luci-base: do not trigger form action when revealing password
authorJo-Philipp Wich <jo@mein.io>
Thu, 22 Nov 2018 13:47:56 +0000 (14:47 +0100)
committerJo-Philipp Wich <jo@mein.io>
Thu, 22 Nov 2018 13:47:56 +0000 (14:47 +0100)
Ref: https://github.com/openwrt/luci/issues/2327
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-base/luasrc/view/cbi/value.htm

index 79a358b3052bb16680dd027c113441f37aa4a718..27f3cb2bd9efc6aa38dd431e2eda89e2db57ac1d 100644 (file)
@@ -21,6 +21,6 @@
                ifattr(#self.keylist > 0, "data-choices", { self.keylist, self.vallist })
        %> />
        <%- if self.password then -%>
-               <button class="cbi-button cbi-button-neutral" title="<%:Reveal/hide password%>" aria-label="<%:Reveal/hide password%>" onclick="var e = this.previousElementSibling; e.type = (e.type === 'password') ? 'text' : 'password'">∗</button>
+               <button class="cbi-button cbi-button-neutral" title="<%:Reveal/hide password%>" aria-label="<%:Reveal/hide password%>" onclick="var e = this.previousElementSibling; e.type = (e.type === 'password') ? 'text' : 'password'; event.preventDefault()">∗</button>
        <% end %>
 <%+cbi/valuefooter%>