Commit 2ab75d9f authored by jose's avatar jose

Fix webshell can't log in

parent b10f6e3c
...@@ -1622,19 +1622,23 @@ function scroll_handle(e){ ...@@ -1622,19 +1622,23 @@ function scroll_handle(e){
var scrollTop = this.scrollTop; var scrollTop = this.scrollTop;
$(this).find("thead").css({"transform":"translateY("+scrollTop+"px)","position":"relative","z-index":"1"}); $(this).find("thead").css({"transform":"translateY("+scrollTop+"px)","position":"relative","z-index":"1"});
} }
var clipboard, interval, socket, gterm,ssh_login; var clipboard, interval, socket, gterm, ssh_login;
var pdata_socket = {
x_http_token: document.getElementById("request_token_head").getAttribute('token')
}
function ssh_login_def() { function ssh_login_def() {
var pdata = { pdata_socket['data'] = {};
ssh_user : $("input[name='ssh_user']").val(), pdata_socket['data']['ssh_user'] = $("input[name='ssh_user']").val();
ssh_passwd: $("input[name='ssh_passwd']").val() pdata_socket['data']['ssh_passwd'] = $("input[name='ssh_passwd']").val();
} if (!pdata_socket.ssh_user || !pdata_socket.ssh_passwd) {
if (!pdata.ssh_user || !pdata.ssh_passwd) {
layer.msg('The SSH username and password cannot be empty!'); layer.msg('The SSH username and password cannot be empty!');
return; return;
} }
layer.close(ssh_login); layer.close(ssh_login);
socket.emit('webssh', pdata); socket.emit('webssh', pdata_socket);
gterm.focus(); gterm.focus();
} }
...@@ -1697,7 +1701,8 @@ function web_shell() { ...@@ -1697,7 +1701,8 @@ function web_shell() {
} }
term.on('data', function (data) { term.on('data', function (data) {
socket.emit('webssh', data); pdata_socket['data'] = data;
socket.emit('webssh', pdata_socket);
}); });
...@@ -1729,8 +1734,10 @@ function web_shell() { ...@@ -1729,8 +1734,10 @@ function web_shell() {
setTimeout(function () { setTimeout(function () {
$('.terminal').detach().appendTo('#term'); $('.terminal').detach().appendTo('#term');
$("#term").show(); $("#term").show();
socket.emit('webssh', "\u0015"); pdata_socket['data'] = "\u0015"
socket.emit('webssh', "\n"); socket.emit('webssh', pdata_socket);
pdata_socket['data'] = "\n"
socket.emit('webssh', pdata_socket);
term.focus(); term.focus();
// 鼠标右键事件 // 鼠标右键事件
...@@ -1821,7 +1828,8 @@ function web_shell() { ...@@ -1821,7 +1828,8 @@ function web_shell() {
if ($(this).text().indexOf('Alt') != -1) { if ($(this).text().indexOf('Alt') != -1) {
ptext +="\n"; ptext +="\n";
} }
socket.emit('webssh', ptext); pdata_socket['data'] = ptext;
socket.emit('webssh', pdata_socket);
term.focus(); term.focus();
}) })
$("textarea[name='ssh_copy']").keydown(function (e) { $("textarea[name='ssh_copy']").keydown(function (e) {
...@@ -1857,8 +1865,9 @@ function shell_to_baidu() { ...@@ -1857,8 +1865,9 @@ function shell_to_baidu() {
} }
function shell_paste_text(){ function shell_paste_text() {
socket.emit('webssh', getCookie('ssh_selection')); pdata_socket['data'] = getCookie('ssh_selection')
socket.emit('webssh', pdata_socket);
remove_ssh_menu(); remove_ssh_menu();
gterm.focus(); gterm.focus();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment