1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-20 10:50:08 +03:00

feature #4145: Add option to request VNC password for external windows

(cherry picked from commit dea4201d6a9f2e6b57e3ad8a125593a575ff0dbb)
This commit is contained in:
Daniel Molina 2015-11-12 17:14:18 +01:00
parent 415030d562
commit 000a6664f6
7 changed files with 25 additions and 27 deletions

View File

@ -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);
}
})

View File

@ -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,

View File

@ -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;

View File

@ -13,29 +13,22 @@
{{! See the License for the specific language governing permissions and }}
{{! limitations under the License. }}
{{! -------------------------------------------------------------------------- }}
<div id="{{dialogId}}" class="reveal-modal large max-height" style="width:auto; max-width:70%" data-reveal >
<div class="row">
<div class="large-12 columns">
<span class="subheader" id="vnc_dialog">
<h3 class="subheader" id="vnc_dialog">
{{tr "VNC"}}
<span id="VNC_status">{{tr "Loading"}}</span>
<a id="open_in_a_new_window" href="" target="_blank" title="{{tr "Open in a new window"}}">
<span class="fa-stack fa-fw detach-vnc-icon"> <i class="fa fa-external-link fa-stack-2x"></i> <i class="fa fa-stack-1x"></i>
</span>
</a>
<a id="open_in_a_new_window_without_pass" href="" target="_blank" title="{{tr "Open in a new window and request password"}}">
<span class="fa-stack fa-fw detach-vnc-icon">
<i class="fa fa-external-link fa-stack-2x"></i>
<i class="fa fa-lock fa-stack-1x"></i>
</span>
</a>
</span>
<a id="open_in_a_new_window" href="" target="_blank" title="{{tr "Open in a new window"}}"> <i class="fa fa-external-link detach-vnc-icon"/></a>
<span id="VNC_buttons" class="right">
<input type="button" value="Send CtrlAltDel" id="sendCtrlAltDelButton"></span>
</h3>
</div>
</div>
<div class="reveal-body" style="width:100%; overflow-x:overlay">
<canvas id="VNC_canvas" width="640px">{{tr "Canvas not supported."}}</canvas>
<div id="VNC_status_bar" class="VNC_status_bar"></div>
</div>
<input type="button" value="Send CtrlAltDel" id="sendCtrlAltDelButton">
<a class="close-reveal-modal">&#215;</a>
</div>

View File

@ -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);
}

View File

@ -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;
}
}
}

View File

@ -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,