diff --git a/src/sunstone/public/app/console/vnc.js b/src/sunstone/public/app/console/vnc.js index 3ff248a2ac2..710dab0ce78 100644 --- a/src/sunstone/public/app/console/vnc.js +++ b/src/sunstone/public/app/console/vnc.js @@ -103,6 +103,9 @@ define(function(require) { var proxy_host = window.location.hostname; var proxy_port = Config.vncProxyPort; var token = getQueryVariable("token"); + var password = getQueryVariable("password"); + + var rfbConfig = password? { "credentials": { "password": password } } : {}; if (window.location.protocol === "https:") { URL = "wss"; @@ -130,7 +133,7 @@ define(function(require) { return; } try{ - rfb = new RFB(document.querySelector("#VNC_canvas"), URL); + rfb = new RFB(document.querySelector("#VNC_canvas"), URL, rfbConfig); }catch(err){ console.log("error start NOVNC ", err); } diff --git a/src/sunstone/public/app/utils/vnc.js b/src/sunstone/public/app/utils/vnc.js index e74ab733a10..34e880c44a2 100644 --- a/src/sunstone/public/app/utils/vnc.js +++ b/src/sunstone/public/app/utils/vnc.js @@ -72,6 +72,8 @@ define(function(require) { var protocol = window.location.protocol; var hostname = window.location.hostname; var port = window.location.port; + var rfbConfig = pw? { "credentials": { "password": pw } } : {}; + if (protocol === "https:") { URL = "wss"; } else { @@ -92,7 +94,7 @@ define(function(require) { var link = URL.replace(re, protocol + "//" + hostname + ":" + port + "/vnc?"); try{ - _rfb = new RFB(document.querySelector("#VNC_canvas"), URL); + _rfb = new RFB(document.querySelector("#VNC_canvas"), URL, rfbConfig); _rfb.addEventListener("connect", connected); _rfb.addEventListener("disconnect", disconnectedFromServer); }catch(err){