Use a simple prompt for passwords in vnc_lite
It's not password-masked, but it allows for a lot simpler code.
This commit is contained in:
parent
26d51e490e
commit
5271e30049
|
@ -106,17 +106,8 @@
|
||||||
// When this function is called, the server requires
|
// When this function is called, the server requires
|
||||||
// credentials to authenticate
|
// credentials to authenticate
|
||||||
function credentialsAreRequired(e) {
|
function credentialsAreRequired(e) {
|
||||||
// Let's create a password input
|
const password = prompt("Password Required:");
|
||||||
const form = document.createElement('form');
|
rfb.sendCredentials({ password: password });
|
||||||
form.innerHTML = '<label></label>';
|
|
||||||
form.innerHTML += '<input type=password size=10 id="password_input">';
|
|
||||||
form.onsubmit = setPassword;
|
|
||||||
|
|
||||||
// Bypass status() because it sets text content
|
|
||||||
// which doesn't allow adding elements
|
|
||||||
document.getElementById('noVNC_status').innerHTML = '';
|
|
||||||
document.getElementById('noVNC_status').appendChild(form);
|
|
||||||
document.getElementById('noVNC_status').querySelector('label').textContent = 'Password Required: ';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// When this function is called we have received
|
// When this function is called we have received
|
||||||
|
@ -125,12 +116,6 @@
|
||||||
desktopName = e.detail.name;
|
desktopName = e.detail.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send the credentials from the input element
|
|
||||||
function setPassword() {
|
|
||||||
rfb.sendCredentials({ password: document.getElementById('password_input').value });
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Since most operating systems will catch Ctrl+Alt+Del
|
// Since most operating systems will catch Ctrl+Alt+Del
|
||||||
// before they get a chance to be intercepted by the browser,
|
// before they get a chance to be intercepted by the browser,
|
||||||
// we provide a way to emulate this key sequence.
|
// we provide a way to emulate this key sequence.
|
||||||
|
|
Loading…
Reference in New Issue