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>
(cherry picked from commit 3235f79)
  • Loading branch information
jloboescalona2 authored and tinova committed Sep 4, 2019
1 parent b216110 commit 42080b8
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 @@ -104,6 +104,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 @@ -131,7 +134,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 42080b8

Please sign in to comment.