]> git.proxmox.com Git - mirror_novnc.git/commitdiff
Use a simple prompt for passwords in vnc_lite
authorSamuel Mannehed <samuel@cendio.se>
Thu, 16 Aug 2018 10:23:54 +0000 (12:23 +0200)
committerSamuel Mannehed <samuel@cendio.se>
Tue, 28 Aug 2018 08:42:39 +0000 (10:42 +0200)
It's not password-masked, but it allows for a lot simpler code.

vnc_lite.html

index 4ba49329e03a4bc4b6e3e7f2cc3a1dd7f259ecf7..71f28d95796a382fd8d8d3ff52b221eaa2054640 100644 (file)
         // 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 = '<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: ';
+            const password = prompt("Password Required:");
+            rfb.sendCredentials({ password: password });
         }
 
         // When this function is called we have received
             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.