mietz
October 14, 2022, 11:18am
1
Hi,
I followed this: Hide root user on LUCI login
To have an empty username field by default on the LUCI login page. But the cursor defaults to the password field. I would like to have it in the username field otherwise Keepass auto type gets confused.
Cheers
Edit: seems to be unnecessary with the bootstrap theme. Skip this post and see later posts.
Find your sysauth.htm file and change the highlighted line below to replace luci_password
with luci_username
</div>
</div></div>
</div>
<div class="cbi-page-actions">
<input type="submit" value="<%:Login%>" class="btn cbi-button cbi-button-apply" />
<input type="reset" value="<%:Reset%>" class="btn cbi-button cbi-button-reset" />
</div>
</form>
<script type="text/javascript">//<![CDATA[
var input = document.getElementsByName('luci_password')[0];
if (input)
input.focus();
//]]></script>
<%
local uci = require "luci.model.uci".cursor()
local fs = require "nixio.fs"
local https_key = uci:get("uhttpd", "main", "key")
local https_port = uci:get("uhttpd", "main", "listen_https")
if type(https_port) == "table" then
2 Likes
mietz
October 14, 2022, 1:23pm
3
dave14305:
sysauth.htm
I found it in /usr/lib/lua/luci/view/sysauth.htm
cleared the cache rm /tmp/luci-modulecache/*
and restarted uhttp /etc/init.d/uhttpd restart
But the cursor is still focused on the password.
Look in any theme subdirectories too.
find /usr/lib -name sysauth.htm
mietz
October 14, 2022, 1:30pm
5
dave14305:
I'm using bootstrap, I think there is nothin that needs to be changed?
/usr/lib/lua/luci/view/themes/bootstrap/sysauth.htm
<%#
Copyright 2021 Jo-Philipp Wich <jo@mein.io>
Licensed to the public under the Apache License 2.0.
-%>
<%
-- tell bootstrap's templates to not render header and footer
blank_page = true
%>
<%+header%>
<section hidden>
<form method="post" class="cbi-map">
<div class="cbi-section">
<div class="cbi-section-node">
<div class="cbi-value">
<label class="cbi-value-title" for="luci_username"><%:Username%></label>
<div class="cbi-value-field">
<input name="luci_username" type="text"<%=attr("value", duser)%>>
</div>
</div>
<div class="cbi-value">
<label class="cbi-value-title" for="luci_password"><%:Password%></label>
<div class="cbi-value-field">
<input name="luci_password" type="password">
</div>
</div>
</div>
</div>
</form>
<hr>
<% if fuser then %>
<div class="alert-message error">
<%:Invalid username and/or password! Please try again.%>
</div>
<% end %>
<button class="btn cbi-button-positive important"><%:Login%></button>
</section>
<div id="view">
<div class="spinning"><%:Loading view…%></div>
<script type="text/javascript">
L.require('ui').then(function(ui) {
ui.instantiateView('bootstrap.sysauth');
});
</script>
</div>
<%+footer%>
How about changing this from type="password"
to name="luci_username"
in /www/luci-static/resources/view/bootstrap/sysauth.js
You are discovering I’m no expert in this area.
btn.click();
});
btn.addEventListener('click', function() {
dlg.querySelectorAll('*').forEach(function(node) { node.style.display = 'none' });
dlg.appendChild(E('div', { 'class': 'spinning' }, _('Logging in…')));
form.submit()
});
document.querySelector('input[type="password"]').focus();
return '';
},
addFooter: function() {}
});
2 Likes
Nice, that is confirmed working!
... and not working now as of v23.05.0
rossini
October 13, 2023, 11:02pm
9
you can also reconfigure keepass for another autofill pattern
Did you re-apply the same change to the new files?
Yes... file is still there and tried luci_username
and just username
as well.
Thanks, reconfig KeePass autotype was exactly what I was going to do as a backup!
Update: There was a luci package update since the initial 23.05.0 release and it is now working again