',
- '
',
- '
需要TELEPORT助手来辅助远程连接,请确认本机运行了TELEPORT助手!
',
+ '
',
- '
如果您尚未运行TELEPORT助手,请 下载最新版TELEPORT助手 并安装。一旦运行了TELEPORT助手,即可重新进行远程连接。
',
+ '
',
'
',
''
].join('\n');
$('body').append($(_html));
+
+ $assist.dom.msg_box_title = $('#assist-msg-box-tittle');
+ $assist.dom.msg_box_info = $('#assist-msg-box-info');
+ $assist.dom.msg_box_desc = $('#assist-msg-box-desc');
};
$assist.do_teleport = function (args, func_success, func_error) {
+ if(!$assist.running) {
+ $assist.errcode = TPE_NO_ASSIST;
+ func_error(TPE_NO_ASSIST, '');
+ return;
+ } else if(!$assist._version_compare()) {
+ $assist.errcode = TPE_OLD_ASSIST;
+ func_error(TPE_NO_ASSIST, '');
+ return;
+ }
+
// 第一步:将参数传递给web服务,准备获取一个远程连接会话ID
var args_ = JSON.stringify(args);
$.ajax({
@@ -127,19 +183,17 @@ $assist.do_teleport = function (args, func_success, func_error) {
// console.log('---', data);
var args_ = encodeURIComponent(JSON.stringify(data));
- //判断是否使用urlprocotol处理方式
+ // 判断是否使用 url-protocol 处理方式
if ($app.options.url_proto){
-
- if(!$("#urlproto").length) {
- var _html = "
";
+ if(!$("#url-protocol").length) {
+ var _html = '
';
$('body').append($(_html));
}
- $("#urlproto").find("iframe").attr("src",'teleport://' + JSON.stringify(data));
+ $("#url-protocol").find("iframe").attr("src",'teleport://' + JSON.stringify(data));
}else{
$.ajax({
type: 'GET',
timeout: 5000,
- //url: 'http://localhost:50022/ts_op/' + args_,
url: $assist.api_url + '/run/' + args_,
jsonp: 'callback',
dataType: 'json',
diff --git a/server/www/teleport/static/js/tp-const.js b/server/www/teleport/static/js/tp-const.js
index fbb4d53..d0e90c0 100755
--- a/server/www/teleport/static/js/tp-const.js
+++ b/server/www/teleport/static/js/tp-const.js
@@ -98,7 +98,7 @@ var TP_POLICY_AUTH_gUSER_gHOST = 8; // 8=用户组:主机组
// =======================================================
// 全局配置
// =======================================================
-var TP_ASSIST_STARTUP_URLPROTO = 1; // 启用urlprotocol功能
+var TP_ASSIST_STARTUP_URLPROTO = 1; // 启用 url-protocol 功能
// =======================================================
// 授权标记
diff --git a/server/www/teleport/static/js/user/change-expired-password.js b/server/www/teleport/static/js/user/change-expired-password.js
index ec4dc2f..2cb1839 100644
--- a/server/www/teleport/static/js/user/change-expired-password.js
+++ b/server/www/teleport/static/js/user/change-expired-password.js
@@ -104,135 +104,172 @@ $app.show_op_box = function (op_type, op_msg) {
$app.dom.op_message.show();
};
-$app.on_send_find_password_email = function () {
+// $app.on_send_find_password_email = function () {
+// $app.hide_op_box();
+// var str_username = $app.dom.find.input_username.val();
+// var str_email = $app.dom.find.input_email.val();
+// var str_captcha = $app.dom.find.input_captcha.val();
+//
+// if (str_username.length === 0) {
+// $app.show_op_box('error', '用户名未填写!');
+// $app.dom.find.input_username.attr('data-content', "请填写您的用户名!").focus().popover('show');
+// return;
+// }
+//
+// if (str_email.length === 0) {
+// $app.show_op_box('error', '电子邮件地址未填写!');
+// $app.dom.find.input_email.attr('data-content', "请填写您的电子邮件地址!").focus().popover('show');
+// return;
+// }
+//
+// if (!tp_is_email(str_email)) {
+// $app.show_op_box('error', '无效的电子邮件地址!');
+// $app.dom.find.input_email.attr('data-content', "请检查输入的电子邮件地址!").focus().popover('show');
+// return;
+// }
+//
+// if (str_captcha.length !== 4) {
+// $app.show_op_box('error', '验证码错误!');
+// $app.dom.find.input_captcha.attr('data-content', "验证码为4位数字和字母的组合,请重新填写!").focus().select().popover('show');
+// return;
+// }
+//
+// $app.dom.find.btn_submit.attr('disabled', 'disabled');
+// $tp.ajax_post_json('/auth/verify-captcha', {captcha: str_captcha},
+// function (ret) {
+// if (ret.code === TPE_OK) {
+// // 验证成功
+// $app.hide_op_box();
+// $app.show_op_box('wait', '
正在发送密码重置确认函,请稍候...');
+// $app.do_send_reset_email(str_username, str_email, str_captcha);
+// }
+// else {
+// $app.dom.find.btn_submit.removeAttr('disabled');
+// $app.hide_op_box();
+// $app.show_op_box('error', tp_error_msg(ret.code, ret.message));
+// $app.dom.captcha_image.attr('src', '/auth/captcha?h=28&rnd=' + Math.random());
+// $app.dom.input_captcha.focus().select().val('');
+// }
+// },
+// function () {
+// $app.hide_op_box();
+// $app.show_op_box('error', '很抱歉,无法连接服务器!请稍后再试一次!');
+// $app.dom.find.btn_submit.removeAttr('disabled');
+// }
+// );
+// };
+//
+// $app.do_send_reset_email = function (str_username, str_email, str_captcha) {
+// $tp.ajax_post_json('/user/do-reset-password', {
+// mode: 3,
+// username: str_username,
+// email: str_email,
+// captcha: str_captcha
+// },
+// function (ret) {
+// if (ret.code === TPE_OK) {
+// $app.dom.find.btn_submit.slideUp('fast');
+// $app.show_op_box('success', '密码重置确认函已发送,请注意查收!');
+// } else {
+// $app.dom.find.btn_submit.removeAttr('disabled');
+// $app.hide_op_box();
+// var msg = '';
+// if (ret.code === TPE_NOT_EXISTS)
+// msg = tp_error_msg(ret.code, '用户不存在,请检查输入的用户和电子邮件地址是否匹配!');
+// else
+// msg = tp_error_msg(ret.code, ret.message);
+// $app.show_op_box('error', msg);
+// }
+// },
+// function () {
+// $app.dom.find.btn_submit.removeAttr('disabled');
+// $app.hide_op_box();
+// $app.show_op_box('error', '网络故障,密码重置确认函发送失败!');
+// },
+// 15000
+// );
+// };
+
+$app.on_change_password = function () {
$app.hide_op_box();
- var str_username = $app.dom.find.input_username.val();
- var str_email = $app.dom.find.input_email.val();
- var str_captcha = $app.dom.find.input_captcha.val();
+ var str_password = $app.dom.txt_password.val();
+ var str_new_password = $app.dom.txt_new_password.val();
+ var str_captcha = $app.dom.txt_captcha.val();
- if (str_username.length === 0) {
- $app.show_op_box('error', '用户名未填写!');
- $app.dom.find.input_username.attr('data-content', "请填写您的用户名!").focus().popover('show');
+ if (str_password.length === 0) {
+ $app.show_op_box('error', '密码未填写!');
+ $app.dom.txt_password.attr('data-content', "请输入您的当前密码!").focus().popover('show');
return;
}
-
- if (str_email.length === 0) {
- $app.show_op_box('error', '电子邮件地址未填写!');
- $app.dom.find.input_email.attr('data-content', "请填写您的电子邮件地址!").focus().popover('show');
- return;
- }
-
- if (!tp_is_email(str_email)) {
- $app.show_op_box('error', '无效的电子邮件地址!');
- $app.dom.find.input_email.attr('data-content', "请检查输入的电子邮件地址!").focus().popover('show');
+ if (str_new_password.length === 0) {
+ $app.show_op_box('error', '请设置新的密码!');
+ $app.dom.txt_new_password.attr('data-content', "请设置您的新密码!").focus().popover('show');
return;
}
if (str_captcha.length !== 4) {
$app.show_op_box('error', '验证码错误!');
- $app.dom.find.input_captcha.attr('data-content', "验证码为4位数字和字母的组合,请重新填写!").focus().select().popover('show');
+ $app.dom.txt_captcha.attr('data-content', "验证码为4位数字和字母的组合,请重新填写!").focus().select().popover('show');
return;
}
- $app.dom.find.btn_submit.attr('disabled', 'disabled');
+ if ($app.options.force_strong) {
+ if (!tp_check_strong_password(str_new_password)) {
+ $app.show_op_box('error', tp_error_msg(TPE_FAILED, '抱歉,不能使用弱密码!'));
+ $app.dom.txt_new_password.attr('data-content', "请设置强密码:至少8位,必须包含大写字母、小写字母以及数字!").focus().popover('show');
+ return;
+ }
+ }
+
+ $app.dom.btn_submit.attr('disabled', 'disabled');
$tp.ajax_post_json('/auth/verify-captcha', {captcha: str_captcha},
function (ret) {
if (ret.code === TPE_OK) {
// 验证成功
$app.hide_op_box();
- $app.show_op_box('wait', '
正在发送密码重置确认函,请稍候...');
- $app.do_send_reset_email(str_username, str_email, str_captcha);
+ $app.show_op_box('wait', '
正在修改密码,请稍候...');
+ $app.do_change_password(str_password, str_new_password, str_captcha);
}
else {
- $app.dom.find.btn_submit.removeAttr('disabled');
+ $app.dom.btn_submit.removeAttr('disabled');
$app.hide_op_box();
$app.show_op_box('error', tp_error_msg(ret.code, ret.message));
- $app.dom.captcha_image.attr('src', '/auth/captcha?h=28&rnd=' + Math.random());
- $app.dom.input_captcha.focus().select().val('');
+ $app.dom.img_captcha.attr('src', '/auth/captcha?h=28&rnd=' + Math.random());
+ $app.dom.txt_captcha.focus().select().val('');
}
},
function () {
$app.hide_op_box();
$app.show_op_box('error', '很抱歉,无法连接服务器!请稍后再试一次!');
- $app.dom.find.btn_submit.removeAttr('disabled');
+ $app.dom.btn_submit.removeAttr('disabled');
}
);
};
-$app.do_send_reset_email = function (str_username, str_email, str_captcha) {
+$app.do_change_password = function (str_password, str_new_password, str_captcha) {
+ // var str_username = $app.options.username;
$tp.ajax_post_json('/user/do-reset-password', {
- mode: 3,
- username: str_username,
- email: str_email,
+ mode: 6,
+ username: $app.options.username,
+ password: str_password,
+ new_password: str_new_password,
captcha: str_captcha
},
function (ret) {
+ $app.dom.btn_submit.removeAttr('disabled');
if (ret.code === TPE_OK) {
- $app.dom.find.btn_submit.slideUp('fast');
- $app.show_op_box('success', '密码重置确认函已发送,请注意查收!');
- } else {
- $app.dom.find.btn_submit.removeAttr('disabled');
- $app.hide_op_box();
- var msg = '';
- if (ret.code === TPE_NOT_EXISTS)
- msg = tp_error_msg(ret.code, '用户不存在,请检查输入的用户和电子邮件地址是否匹配!');
- else
- msg = tp_error_msg(ret.code, ret.message);
- $app.show_op_box('error', msg);
- }
- },
- function () {
- $app.dom.find.btn_submit.removeAttr('disabled');
- $app.hide_op_box();
- $app.show_op_box('error', '网络故障,密码重置确认函发送失败!');
- },
- 15000
- );
-};
-
-$app.on_set_new_password = function () {
- $app.hide_op_box();
- var str_password = $app.dom.set_password.input_password.val();
-
- if (str_password.length === 0) {
- $app.show_op_box('error', '密码未填写!');
- $app.dom.set_password.input_password.attr('data-content', "请设置您的新密码!").focus().popover('show');
- return;
- }
-
- if ($app.options.force_strong) {
- if (!tp_check_strong_password(str_password)) {
- $app.show_op_box('error', tp_error_msg(TPE_FAILED, '抱歉,不能使用弱密码!'));
- $app.dom.set_password.input_password.attr('data-content', "请设置强密码:至少8位,必须包含大写字母、小写字母以及数字!").focus().popover('show');
- return;
- }
- }
-
- $tp.ajax_post_json('/user/do-reset-password', {
- mode: 4,
- token: $app.options.token,
- password: str_password
- },
- function (ret) {
- $app.dom.find.btn_submit.removeAttr('disabled');
- if (ret.code === TPE_OK) {
- $app.show_op_box('success', '密码已重置,正在转到登录界面!');
+ $app.show_op_box('success', '密码已修改,正在转到登录界面!');
setTimeout(function () {
window.location.href = '/';
}, 2000);
} else {
- var msg = '';
- if (ret.code === TPE_NOT_EXISTS)
- msg = tp_error_msg(ret.code, '无效的密码重置链接!');
- else
- msg = tp_error_msg(ret.code, ret.message);
- $app.show_op_box('error', msg);
+ $app.show_op_box('error', tp_error_msg(ret.code, ret.message));
}
},
function () {
$app.dom.find.btn_submit.removeAttr('disabled');
$app.hide_op_box();
- $app.show_op_box('error', '网络故障,密码重置失败!');
+ $app.show_op_box('error', '网络故障,密码修改失败!');
}
);
};
diff --git a/server/www/teleport/static/js/user/user-group-list.js b/server/www/teleport/static/js/user/user-group-list.js
index caf38ca..e27d928 100644
--- a/server/www/teleport/static/js/user/user-group-list.js
+++ b/server/www/teleport/static/js/user/user-group-list.js
@@ -176,7 +176,7 @@ $app.on_table_groups_cell_created = function (tbl, row_id, col_key, cell_obj) {
$app.dlg_edit_group.show_edit(_row_id);
});
cell_obj.find('[data-btn-remove]').click(function () {
- console.log(_row_id);
+ // console.log(_row_id);
$app.on_btn_remove_group_click(_row_id);
});
}
@@ -274,7 +274,7 @@ $app.on_table_groups_render_created = function (render) {
if (_.isUndefined(fields.members))
return '';
- console.log(fields.members);
+ // console.log(fields.members);
var ret = [];
for (var i = 0; i < fields.members.length; ++i) {
@@ -538,7 +538,7 @@ $app.create_dlg_edit_group = function () {
};
dlg.on_save = function () {
- console.log('---save.');
+ // console.log('---save.');
dlg.hide_error();
if (!dlg.check_input())
return;
diff --git a/server/www/teleport/static/js/user/user-list.js b/server/www/teleport/static/js/user/user-list.js
index 6c233eb..cd8d6ad 100755
--- a/server/www/teleport/static/js/user/user-list.js
+++ b/server/www/teleport/static/js/user/user-list.js
@@ -2,7 +2,7 @@
$app.on_init = function (cb_stack) {
- console.log($app.options);
+ // console.log($app.options);
$app.dom = {
btn_refresh_user_list: $('#btn-refresh-user-list'),
@@ -233,7 +233,7 @@ $app.on_table_users_cell_created = function (tbl, row_id, col_key, cell_obj) {
if (action === 'edit') {
$app.dlg_edit_user.show_edit(row_id);
} else if (action === 'reset-password') {
- console.log(user);
+ // console.log(user);
if(user.type === TP_USER_TYPE_LDAP)
return;
$app.dlg_reset_password.show_edit(row_id);
@@ -464,8 +464,8 @@ $app.on_btn_select_file_click = function () {
$app.dom.upload_file_message.hide();
// var dom_file_name = $('#upload-file-name');
- console.log(btn_file_selector[0]);
- console.log(btn_file_selector[0].files);
+ // console.log(btn_file_selector[0]);
+ // console.log(btn_file_selector[0].files);
var file = null;
if (btn_file_selector[0].files && btn_file_selector[0].files[0]) {
@@ -474,7 +474,7 @@ $app.on_btn_select_file_click = function () {
file = btn_file_selector[0].files.item(0);
}
- console.log(file);
+ // console.log(file);
if (file === null) {
$app.dom.upload_file_info.html('请点击图标,选择要上传的文件!');
@@ -527,7 +527,7 @@ $app.on_btn_do_upload_click = function () {
var ret = JSON.parse(data);
- console.log('import ret', ret);
+ // console.log('import ret', ret);
if (ret.code === TPE_OK) {
$app.dom.upload_file_message
@@ -931,7 +931,7 @@ $app.create_dlg_edit_user = function () {
dlg.show_edit = function (row_id) {
var user = $app.table_users.get_row(row_id);
- console.log(user);
+ // console.log(user);
dlg.init_fields(user);
dlg.dom.dialog.modal({backdrop: 'static'});
};
@@ -1406,7 +1406,7 @@ $app.create_dlg_ldap_config = function () {
dlg.dom.btn_list_attr.removeAttr('disabled');
if (ret.code === TPE_OK) {
$tp.notify_success('列举LDAP用户属性成功!');
- console.log(ret.data);
+ // console.log(ret.data);
$app.dlg_ldap_list_attr_result.show(ret.data.attributes);
} else {
$tp.notify_error('列举LDAP用户属性失败:' + tp_error_msg(ret.code, ret.message));
@@ -1435,7 +1435,7 @@ $app.create_dlg_ldap_config = function () {
function (ret) {
dlg.dom.btn_test.removeAttr('disabled');
if (ret.code === TPE_OK) {
- console.log(ret.data);
+ // console.log(ret.data);
$tp.notify_success('LDAP连接测试成功!');
$app.dlg_ldap_test_result.show(ret.data);
} else {
@@ -1547,7 +1547,7 @@ $app.create_dlg_ldap_test_result = function () {
var dn;
for (dn in data) {
h.push('
');
- console.log(data[dn]);
+ // console.log(data[dn]);
_mktd(h, data[dn]['username']);
_mktd(h, data[dn]['surname']);
_mktd(h, data[dn]['email']);
@@ -1727,7 +1727,7 @@ $app.create_dlg_ldap_import = function () {
function (ret) {
dlg.dom.btn_refresh.removeAttr('disabled');
if (ret.code === TPE_OK) {
- console.log(ret.data);
+ // console.log(ret.data);
var _d = [];
for (var i = 0; i < ret.data.length; ++i) {
@@ -1755,7 +1755,7 @@ $app.create_dlg_ldap_import = function () {
return;
}
- console.log(items);
+ // console.log(items);
dlg.dom.btn_import.attr('disabled', 'disabled');
$tp.ajax_post_json('/system/do-ldap-import', {ldap_users: items},
diff --git a/server/www/teleport/view/auth/login.mako b/server/www/teleport/view/auth/login.mako
index a50280f..4af522c 100644
--- a/server/www/teleport/view/auth/login.mako
+++ b/server/www/teleport/view/auth/login.mako
@@ -20,7 +20,7 @@
-