luci-base: ui.js: set `autocomplete="new-password"` for password fields
authorJo-Philipp Wich <jo@mein.io>
Wed, 7 Jun 2023 21:40:04 +0000 (23:40 +0200)
committerJo-Philipp Wich <jo@mein.io>
Thu, 2 Nov 2023 10:47:33 +0000 (11:47 +0100)
Attempt to prevent Firefox from randomly filling nonesense into arbitrary
password fields such as the WireGuard private key field by setting the
`autocomplete="new-password"` attribute on any password type fields.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 23a246e4b4d0a0959d16a1add3868361b78f3021)

modules/luci-base/htdocs/luci-static/resources/ui.js

index b35a51ce64b6baaf09e0e0b9b288d5958e5b764a..29810d57986bf117c83013e0d0f488c03c9b46d6 100644 (file)
@@ -374,6 +374,7 @@ var UITextfield = UIElement.extend(/** @lends LuCI.ui.Textfield.prototype */ {
                        'disabled': this.options.disabled ? '' : null,
                        'maxlength': this.options.maxlength,
                        'placeholder': this.options.placeholder,
+                       'autocomplete': this.options.password ? 'new-password' : null,
                        'value': this.value,
                });