temp.
							parent
							
								
									05297ec5e5
								
							
						
					
					
						commit
						c27da966e9
					
				
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| 
						 | 
				
			
			@ -1,8 +1,3 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Created by mi on 2016/7/27.
 | 
			
		||||
 * Upgrade for new record-format by Apex on 2017-01-08
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
var g_header = null;
 | 
			
		||||
| 
						 | 
				
			
			@ -37,16 +32,13 @@ $app.req_record_data = function (record_id, offset) {
 | 
			
		|||
    $tp.ajax_post_json('/audit/get-record-data', {id: record_id, offset: offset},
 | 
			
		||||
        function (ret) {
 | 
			
		||||
            if (ret.code === TPE_OK) {
 | 
			
		||||
                console.log('data', ret.data);
 | 
			
		||||
                // console.log('data', ret.data);
 | 
			
		||||
                g_data = g_data.concat(ret.data.data_list);
 | 
			
		||||
                g_data_offset += ret.data.data_size;
 | 
			
		||||
 | 
			
		||||
                if (g_data.length < g_header.pkg_count) {
 | 
			
		||||
                    $app.req_record_data(record_id, g_data_offset);
 | 
			
		||||
                }
 | 
			
		||||
                // else if(g_header.pkg_count < g_data.length) {
 | 
			
		||||
                //     g_header.pkg_count = g_data.length;
 | 
			
		||||
                // }
 | 
			
		||||
            } else {
 | 
			
		||||
                console.log('req_record_info error ', ret.code);
 | 
			
		||||
            }
 | 
			
		||||
| 
						 | 
				
			
			@ -82,7 +74,7 @@ $app.on_init = function (cb_stack, cb_args) {
 | 
			
		|||
        function (ret) {
 | 
			
		||||
            if (ret.code === TPE_OK) {
 | 
			
		||||
                g_header = ret.data;
 | 
			
		||||
                console.log('header', g_header);
 | 
			
		||||
                // console.log('header', g_header);
 | 
			
		||||
 | 
			
		||||
                $('#recorder-info').html(tp_format_datetime(g_header.start) + ': ' + g_header.user_name + '@' + g_header.client_ip + ' 访问 ' + g_header.account + '@' + g_header.conn_ip + ':' + g_header.conn_port);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -90,8 +82,8 @@ $app.on_init = function (cb_stack, cb_args) {
 | 
			
		|||
 | 
			
		||||
                setTimeout(init, 1000);
 | 
			
		||||
            } else {
 | 
			
		||||
                $tp.notify_error('请求录像数据失败');
 | 
			
		||||
                console.log('load init info error ', ret.code);
 | 
			
		||||
                $tp.notify_error('请求录像数据失败'+tp_error_msg(ret.code, ret.message));
 | 
			
		||||
                console.error('load init info error ', ret.code);
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        function () {
 | 
			
		||||
| 
						 | 
				
			
			@ -125,7 +117,7 @@ $app.on_init = function (cb_stack, cb_args) {
 | 
			
		|||
            obj.removeClass('fa-square-o').addClass('fa-check-square-o');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        console.log('skip:', g_skip);
 | 
			
		||||
        // console.log('skip:', g_skip);
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    $app.dom.btn_restart.click(function () {
 | 
			
		||||
| 
						 | 
				
			
			@ -212,7 +204,7 @@ $app.on_init = function (cb_stack, cb_args) {
 | 
			
		|||
                continue;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            console.log(play_data.t, g_current_time);
 | 
			
		||||
            // console.log(play_data.t, g_current_time);
 | 
			
		||||
            if (play_data.t < g_current_time) {
 | 
			
		||||
                if(play_data.a === 1) {
 | 
			
		||||
                    g_console_term.resize(play_data.w, play_data.h);
 | 
			
		||||
| 
						 | 
				
			
			@ -59,7 +59,7 @@ $app.create_info_table = function () {
 | 
			
		|||
            h.push(_info._make_info('与WEB服务通讯地址', $app.options.core_cfg.web_server_rpc));
 | 
			
		||||
            h.push(_info._make_protocol_info('RDP 端口', $app.options.core_cfg.rdp));
 | 
			
		||||
            h.push(_info._make_protocol_info('SSH 端口', $app.options.core_cfg.ssh));
 | 
			
		||||
            // h.push(_info._make_protocol_info('TELNET 端口', $app.options.core_cfg.telnet));
 | 
			
		||||
            h.push(_info._make_protocol_info('TELNET 端口', $app.options.core_cfg.telnet));
 | 
			
		||||
            h.push(_info._make_info('录像文件路径', $app.options.core_cfg.replay_path));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -473,7 +473,7 @@ $app.create_config_storage = function () {
 | 
			
		|||
            _info.push('未能连接到核心服务,无法获取存储空间信息!');
 | 
			
		||||
        } else {
 | 
			
		||||
            _sto.dom.storage_size.removeClass().addClass('alert alert-info');
 | 
			
		||||
            _info.push('<p>会话录像存储路径:<code>' + $app.options.core_cfg.replay_path + '</code></p>');
 | 
			
		||||
            _info.push('<p>会话录像存储路径:<span class="mono">' + $app.options.core_cfg.replay_path + '</span></p>');
 | 
			
		||||
            _info.push('<p>会话录像存储空间:总 ' + tp_size2str($app.options.total_size, 2) + ',' + '可用 ' + tp_size2str($app.options.free_size, 2) + '。</p>');
 | 
			
		||||
        }
 | 
			
		||||
        _sto.dom.storage_size.html(_info.join(''));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -196,10 +196,11 @@ $app.do_send_reset_email = function (str_username, str_email, str_captcha) {
 | 
			
		|||
            captcha: str_captcha
 | 
			
		||||
        },
 | 
			
		||||
        function (ret) {
 | 
			
		||||
            $app.dom.find.btn_submit.removeAttr('disabled');
 | 
			
		||||
            if (ret.code === TPE_OK) {
 | 
			
		||||
                $app.show_op_box('success', '密码重置确认函已发送!');
 | 
			
		||||
                $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)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -26,14 +26,18 @@
 | 
			
		|||
      &.value {
 | 
			
		||||
        text-align: left;
 | 
			
		||||
        //padding-left:10px;
 | 
			
		||||
        //font-weight: bold;
 | 
			
		||||
        font-weight: bold;
 | 
			
		||||
        font-family: @font-family-mono;
 | 
			
		||||
        color: #767676;
 | 
			
		||||
        color: #3e3e3e;
 | 
			
		||||
      }
 | 
			
		||||
      .error {
 | 
			
		||||
        color: #cc3632;
 | 
			
		||||
        font-weight: bold;
 | 
			
		||||
      }
 | 
			
		||||
      .disabled {
 | 
			
		||||
        color: #848484;
 | 
			
		||||
        //font-weight: bold;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    &.table-info-list-lite {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@
 | 
			
		|||
 | 
			
		||||
<%block name="extend_js_file">
 | 
			
		||||
    <script type="text/javascript" src="${ static_url('plugins/xterm/xterm.js') }"></script>
 | 
			
		||||
    <script type="text/javascript" src="${ static_url('js/audit/replay.js') }"></script>
 | 
			
		||||
    <script type="text/javascript" src="${ static_url('js/audit/replay-ssh.js') }"></script>
 | 
			
		||||
</%block>
 | 
			
		||||
 | 
			
		||||
<%block name="extend_css_file">
 | 
			
		||||
| 
						 | 
				
			
			@ -21,7 +21,6 @@
 | 
			
		|||
        }
 | 
			
		||||
        #xterm-box {
 | 
			
		||||
            margin: 10px 0;
 | 
			
		||||
            padding: 5px;
 | 
			
		||||
            background-color: #1e1e1e;
 | 
			
		||||
            ##             margin-top: 10px;
 | 
			
		||||
            ##             margin-bottom: 48px;
 | 
			
		||||
| 
						 | 
				
			
			@ -46,6 +45,8 @@
 | 
			
		|||
        }
 | 
			
		||||
 | 
			
		||||
        .terminal .xterm-rows {
 | 
			
		||||
##             margin:5px;
 | 
			
		||||
##             padding:5px;
 | 
			
		||||
            border-right: 1px dashed #363636;
 | 
			
		||||
            background-color: #1e1e1e;
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -41,6 +41,7 @@
 | 
			
		|||
                                    <span class="input-group-addon"><i class="fa fa-key fa-fw"></i></span>
 | 
			
		||||
                                    <input data-field="password" type="password" class="form-control" placeholder="密码" data-toggle="popover" data-trigger="manual" data-placement="top">
 | 
			
		||||
                                </div>
 | 
			
		||||
                                <p class="input-addon-desc"><a href="/user/reset-password">忘记密码?</a></p>
 | 
			
		||||
                            </div>
 | 
			
		||||
 | 
			
		||||
                        </div>
 | 
			
		||||
| 
						 | 
				
			
			@ -48,8 +49,7 @@
 | 
			
		|||
                        <div id="login-area-captcha" class="inputbox">
 | 
			
		||||
                            <div class="input-group input-group-lg">
 | 
			
		||||
                                <span class="input-group-addon"><i class="fa fa-check-square-o fa-fw"></i></span>
 | 
			
		||||
                                <input id="captcha" type="text" class="form-control" placeholder="验证码"
 | 
			
		||||
                                       data-toggle="popover" data-trigger="manual" data-placement="top">
 | 
			
		||||
                                <input id="captcha" type="text" class="form-control" placeholder="验证码" data-toggle="popover" data-trigger="manual" data-placement="top">
 | 
			
		||||
                                <span class="input-group-addon"><a href="javascript:;"><img id="captcha-image" src=""></a></span>
 | 
			
		||||
                            </div>
 | 
			
		||||
                            <p class="input-addon-desc">验证码,点击图片可更换</p>
 | 
			
		||||
| 
						 | 
				
			
			@ -59,8 +59,7 @@
 | 
			
		|||
                            <div class="inputbox">
 | 
			
		||||
                                <div class="input-group input-group-lg">
 | 
			
		||||
                                    <span class="input-group-addon"><i class="fa fa-clock-o fa-fw"></i></span>
 | 
			
		||||
                                    <input id="oath-code" type="text" class="form-control" placeholder="6位数字身份验证器动态验证码"
 | 
			
		||||
                                           data-toggle="popover" data-trigger="manual" data-placement="top">
 | 
			
		||||
                                    <input id="oath-code" type="text" class="form-control" placeholder="6位数字身份验证器动态验证码" data-toggle="popover" data-trigger="manual" data-placement="top">
 | 
			
		||||
                                </div>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -146,7 +146,7 @@ class ReplayHandler(TPBaseHandler):
 | 
			
		|||
            return
 | 
			
		||||
        elif protocol == TP_PROTOCOL_TYPE_SSH:
 | 
			
		||||
            param = {'record_id': record_id}
 | 
			
		||||
            self.render('audit/replay.mako', page_param=json.dumps(param))
 | 
			
		||||
            self.render('audit/replay-ssh.mako', page_param=json.dumps(param))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# # class PlayRdpHandler(TPBaseAdminAuthHandler):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -227,16 +227,20 @@ def set_password(handler, user_id, password):
 | 
			
		|||
    db = get_db()
 | 
			
		||||
 | 
			
		||||
    operator = handler.get_current_user()
 | 
			
		||||
    print('----------', operator)
 | 
			
		||||
 | 
			
		||||
    # 1. get user info (user name)
 | 
			
		||||
    s = SQL(db)
 | 
			
		||||
    err = s.reset().select_from('user', ['username']).where('user.id={}'.format(user_id)).query()
 | 
			
		||||
    err = s.reset().select_from('user', ['username', 'surname']).where('user.id={}'.format(user_id)).query()
 | 
			
		||||
    if err != TPE_OK:
 | 
			
		||||
        return err
 | 
			
		||||
    if len(s.recorder) == 0:
 | 
			
		||||
        return TPE_NOT_EXISTS
 | 
			
		||||
 | 
			
		||||
    name = s.recorder[0]['username']
 | 
			
		||||
    surname = s.recorder[0]['surname']
 | 
			
		||||
    if len(surname) == 0:
 | 
			
		||||
        surname = name
 | 
			
		||||
 | 
			
		||||
    sql = 'UPDATE `{}user` SET password="{password}" WHERE id={user_id};' \
 | 
			
		||||
          ''.format(db.table_prefix, password=password, user_id=user_id)
 | 
			
		||||
| 
						 | 
				
			
			@ -244,7 +248,10 @@ def set_password(handler, user_id, password):
 | 
			
		|||
    if not db_ret:
 | 
			
		||||
        return TPE_DATABASE
 | 
			
		||||
 | 
			
		||||
    syslog.sys_log(operator, handler.request.remote_ip, TPE_OK, "为用户 {} 手动重置了密码".format(name))
 | 
			
		||||
    if operator['id'] == 0:
 | 
			
		||||
        syslog.sys_log({'username': name, 'surname': surname}, handler.request.remote_ip, TPE_OK, "用户 {} 通过找回密码功能重置了密码".format(name))
 | 
			
		||||
    else:
 | 
			
		||||
        syslog.sys_log(operator, handler.request.remote_ip, TPE_OK, "为用户 {} 手动重置了密码".format(name))
 | 
			
		||||
 | 
			
		||||
    return TPE_OK
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue