From 5271e30049b931d301c9cac228a2c20f5b9dd16b Mon Sep 17 00:00:00 2001 From: Samuel Mannehed Date: Thu, 16 Aug 2018 12:23:54 +0200 Subject: Use a simple prompt for passwords in vnc_lite It's not password-masked, but it allows for a lot simpler code. --- vnc_lite.html | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/vnc_lite.html b/vnc_lite.html index 4ba4932..71f28d9 100644 --- a/vnc_lite.html +++ b/vnc_lite.html @@ -106,17 +106,8 @@ // When this function is called, the server requires // credentials to authenticate function credentialsAreRequired(e) { - // Let's create a password input - const form = document.createElement('form'); - form.innerHTML = ''; - form.innerHTML += ''; - 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: '; + const password = prompt("Password Required:"); + rfb.sendCredentials({ password: password }); } // When this function is called we have received @@ -125,12 +116,6 @@ 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 // before they get a chance to be intercepted by the browser, // we provide a way to emulate this key sequence. -- cgit v1.2.1