From 000a6664f6ac17008ea3e0d41b817584b354c13e Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Thu, 12 Nov 2015 17:14:18 +0100 Subject: [PATCH] feature #4145: Add option to request VNC password for external windows (cherry picked from commit dea4201d6a9f2e6b57e3ad8a125593a575ff0dbb) --- src/sunstone/public/app/console/vnc.js | 7 ++++++- src/sunstone/public/app/sunstone-config.js | 1 + .../public/app/tabs/provision-tab/vms/list.js | 6 +++++- .../app/tabs/vms-tab/dialogs/vnc/html.hbs | 19 ++++++------------- src/sunstone/public/app/utils/vnc.js | 7 +++++-- src/sunstone/public/scss/app.scss | 11 +---------- src/sunstone/views/index.erb | 1 + 7 files changed, 25 insertions(+), 27 deletions(-) diff --git a/src/sunstone/public/app/console/vnc.js b/src/sunstone/public/app/console/vnc.js index 231bb49cd0..47d3430799 100644 --- a/src/sunstone/public/app/console/vnc.js +++ b/src/sunstone/public/app/console/vnc.js @@ -38,6 +38,7 @@ define(function(require) { var host = WebUtil.getQueryVar('host', window.location.hostname); var port = WebUtil.getQueryVar('port', window.location.port); var token = WebUtil.getQueryVar('token', null); + var password = WebUtil.getQueryVar('password', null); var path = WebUtil.getQueryVar('path', 'websockify'); function passwordRequired(rfb) { @@ -154,5 +155,9 @@ define(function(require) { 'onXvpInit': xvpInit, 'onPasswordRequired': passwordRequired}); - rfb.connect(host, port, undefined, path + "?token=" + token); + if (password) { + rfb.connect(host, port, password, path + "?token=" + token); + } else { + rfb.connect(host, port, undefined, path + "?token=" + token); + } }) diff --git a/src/sunstone/public/app/sunstone-config.js b/src/sunstone/public/app/sunstone-config.js index b558b378a4..c8c266d8ce 100644 --- a/src/sunstone/public/app/sunstone-config.js +++ b/src/sunstone/public/app/sunstone-config.js @@ -142,6 +142,7 @@ define(function(require) { 'tableOrder': _config['user_config']['table_order'], 'vncProxyPort': _config['system_config']['vnc_proxy_port'], 'vncWSS': _config['user_config']['vnc_wss'], + 'requestVNCPassword': _config['system_config']['vnc_request_password'], 'logo': (_config['view']["small_logo"] || "images/one_small_logo.png"), 'enabledTabs': _config['view']['enabled_tabs'], "defaultCost" : _defaultCost, diff --git a/src/sunstone/public/app/tabs/provision-tab/vms/list.js b/src/sunstone/public/app/tabs/provision-tab/vms/list.js index 40f9aa5147..3872cfde11 100644 --- a/src/sunstone/public/app/tabs/provision-tab/vms/list.js +++ b/src/sunstone/public/app/tabs/provision-tab/vms/list.js @@ -853,7 +853,11 @@ define(function(require) { url += "host=" + proxy_host; url += "&port=" + proxy_port; url += "&token=" + token; - url += "&password=" + pw; + + if (!Config.requestVNCPassword) { + url += "&password=" + pw; + } + url += "&encrypt=" + config['user_config']['vnc_wss']; url += "&title=" + vm_name; diff --git a/src/sunstone/public/app/tabs/vms-tab/dialogs/vnc/html.hbs b/src/sunstone/public/app/tabs/vms-tab/dialogs/vnc/html.hbs index 72880892af..583a658a18 100644 --- a/src/sunstone/public/app/tabs/vms-tab/dialogs/vnc/html.hbs +++ b/src/sunstone/public/app/tabs/vms-tab/dialogs/vnc/html.hbs @@ -13,29 +13,22 @@ {{! See the License for the specific language governing permissions and }} {{! limitations under the License. }} {{! -------------------------------------------------------------------------- }} +
- +

{{tr "VNC"}} {{tr "Loading"}} - - - - - - - - - - - + + + +

{{tr "Canvas not supported."}}
- ×
\ No newline at end of file diff --git a/src/sunstone/public/app/utils/vnc.js b/src/sunstone/public/app/utils/vnc.js index db21ff3aab..19e8b6e5e9 100644 --- a/src/sunstone/public/app/utils/vnc.js +++ b/src/sunstone/public/app/utils/vnc.js @@ -77,8 +77,11 @@ define(function(require) { url += "&encrypt=" + Config.vncWSS; url += "&title=" + vm_name; - $("#open_in_a_new_window_without_pass").attr('href', url); - $("#open_in_a_new_window").attr('href', url + "&password=" + pw); + if (!Config.requestVNCPassword) { + url += "&password=" + pw; + } + + $("#open_in_a_new_window").attr('href', url); _rfb.connect(proxy_host, proxy_port, pw, path); } diff --git a/src/sunstone/public/scss/app.scss b/src/sunstone/public/scss/app.scss index 199b981669..5ea1e61659 100644 --- a/src/sunstone/public/scss/app.scss +++ b/src/sunstone/public/scss/app.scss @@ -1325,13 +1325,4 @@ hr { .custom_tags td { vertical-align: top; -} - -#vnc_dialog { - a { - margin-right: 5px; - margin-left: 5px; - margin-top: -3px; - font-size: 14px; - } -} \ No newline at end of file +} \ No newline at end of file diff --git a/src/sunstone/views/index.erb b/src/sunstone/views/index.erb index b5c8a3afeb..bc8e2e6b1e 100644 --- a/src/sunstone/views/index.erb +++ b/src/sunstone/views/index.erb @@ -31,6 +31,7 @@ }, 'system_config' : { 'marketplace_url' : '<%= $conf[:marketplace_url] %>', + 'vnc_request_password' : <%= $conf[:vnc_request_password] || false %>, 'vnc_proxy_port' : '<%= $vnc.proxy_port %>' }, 'view' : view,