Skip to content

Commit

Permalink
B #3597: fix VNC with VN password enable (#3651)
Browse files Browse the repository at this point in the history
Signed-off-by: Jorge Lobo <jlobo@opennebula.systems>
  • Loading branch information
jloboescalona2 authored and Tino V谩zquez committed Sep 4, 2019
1 parent dd3fd1f commit 3235f79
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/sunstone/public/app/console/vnc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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);
}
Expand Down
4 changes: 3 additions & 1 deletion src/sunstone/public/app/utils/vnc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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){
Expand Down

0 comments on commit 3235f79

Please sign in to comment.