modules/base: attempt to work around Firefox autocomplete bugs
authorJo-Philipp Wich <jow@openwrt.org>
Mon, 20 Oct 2014 17:44:24 +0000 (19:44 +0200)
committerJo-Philipp Wich <jow@openwrt.org>
Mon, 20 Oct 2014 17:45:28 +0000 (19:45 +0200)
Ref: https://dev.openwrt.org/ticket/18176

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
modules/base/luasrc/dispatcher.lua
modules/base/luasrc/view/sysauth.htm

index 9e5b78d..f7e16e7 100644 (file)
@@ -145,8 +145,8 @@ function error500(message)
 end
 
 function authenticator.htmlauth(validator, accs, default)
-       local user = luci.http.formvalue("username")
-       local pass = luci.http.formvalue("password")
+       local user = luci.http.formvalue("luci_username")
+       local pass = luci.http.formvalue("luci_password")
 
        if user and validator(user, pass) then
                return user
index 7c39f0d..e87f26c 100644 (file)
@@ -27,13 +27,13 @@ You may obtain a copy of the License at
                        <div class="cbi-value">
                                <label class="cbi-value-title"><%:Username%></label>
                                <div class="cbi-value-field">
-                                       <input class="cbi-input-user" type="text" name="username" value="<%=duser%>" />
+                                       <input class="cbi-input-user" type="text" name="luci_username" value="<%=duser%>" />
                                </div>
                        </div>
                        <div class="cbi-value cbi-value-last">
                                <label class="cbi-value-title"><%:Password%></label>
                                <div class="cbi-value-field">
-                                       <input id="focus_password" class="cbi-input-password" type="password" name="password" />
+                                       <input class="cbi-input-password" type="password" name="luci_password" />
                                </div>
                        </div>
                </fieldset></fieldset>
@@ -45,7 +45,7 @@ You may obtain a copy of the License at
        </div>
 </form>
 <script type="text/javascript">//<![CDATA[
-       var input = document.getElementById('focus_password');
+       var input = document.getElementsByName('luci_password')[0];
        if (input)
                input.focus();
 //]]></script>