Files
luci/themes/luci-theme-bootstrap/htdocs/luci-static/resources/view/bootstrap/sysauth.js
Eamon Xiong 8a8e4d53a7 luci-theme-bootstrap: use ES6 syntax
Replaced L.bind with arrow functions, used Array.from for array conversion,
applied concise method syntax, and switched to block-scoped declarations.

Signed-off-by: Eamon Xiong <eamonxiong@gmail.com>
2025-11-17 23:40:51 +08:00

39 lines
740 B
JavaScript

'use strict';
'require ui';
'require view';
return view.extend({
render() {
const form = document.querySelector('form');
const btn = document.querySelector('button');
const dlg = ui.showModal(
_('Authorization Required'),
Array.from(document.querySelectorAll('section > *')),
'login'
);
form.addEventListener('keypress', (ev) => {
if (ev.key === 'Enter')
btn.click();
});
btn.addEventListener('click', () => {
dlg.querySelectorAll('*').forEach((node) => {
node.style.display = 'none';
});
dlg.appendChild(E('div', {
class: 'spinning'
}, _('Logging in…')));
form.submit();
});
document.querySelector('input[type="password"]').focus();
return '';
},
addFooter() {},
});