One Hat Cyber Team
  • Dir : ~/www/server/panel/BTPanel/static/js/
  • Edit File: config.js
    \
    \
    Certificate (in pem format)
    \ \
    \
    \ \ '); set_height(); }); } } }, { html: '\
    \ \ \ ' + lan.config.ssl_open_ps_5 + '\
    \ ' } ], btns: [ { title: 'Close', name: 'close', callback: function (rdata, load, callback) { load.close(); $("#panelSSL").prop("checked", false); } }, { title: 'Submit', name: 'submit', css: 'btn-success', callback: function (rdata, load, callback) { if (!$('#checkSSL').is(':checked')) return bt.msg({ status: false, msg: 'Please confirm the risk first!' }); layer.confirm('Whether to open the panel SSL certificate', { title: 'Tips', btn: ['Confirm', 'Cancel'], icon: 0, closeBtn: 2 }, function () { var loading = bt.load(); var type = $('select[name="cert_type"]').val(); if (type == '3') { SavePanelSSL({ loading: false, callback: function (res) { SetPanelSSL(rdata, function (res) { loading.close(); }); } }); } else { SetPanelSSL(rdata, function (rdata) { loading.close(); }); } }); } } ], end: function () { $("#panelSSL").prop("checked", false); } }; var _bs = bt.render_form(_data); setTimeout(function () { $('.cert_type' + _bs).trigger('change') }, 200); }); } } function SetPanelSSL(rdata, callback) { bt.send('SetPanelSSL', 'config/SetPanelSSL', rdata, function (rdata) { if (callback) callback(rdata); if (rdata.status) { $.get('/system?action=ReWeb'); layer.msg(rdata.msg, {icon: 1, time: 1500}, function () { window.location.href = ((window.location.protocol.indexOf('https') != -1) ? 'http://' : 'https://') + window.location.host + window.location.pathname; }); } else { layer.msg(rdata.msg, {icon: 2}); } }); } function GetPanelSSL() { var loadT = layer.msg(lan.config.get_cert, {icon: 16, time: 0, shade: [0.3, '#000']}); $.post('/config?action=GetPanelSSL', {}, function (cert) { layer.close(loadT); var certBody = '
    \
    \
    ' + lan.config.key + '
    \ \
    \
    ' + lan.config.pem_cert + '
    \ \
    \
    \ \
    \
    \ \
    ' layer.open({ type: 1, area: "600px", title: lan.config.custom_panel_cert, closeBtn: 2, shift: 5, shadeClose: false, content: certBody }); }); } // function SavePanelSSL(){ // var data = { // privateKey:$("#key").val(), // certPem:$("#csr").val() // } // var loadT = layer.msg(lan.config.ssl_msg,{icon:16,time:0,shade: [0.3, '#000']}); // $.post('/config?action=SavePanelSSL',data,function(rdata){ // layer.close(loadT); // if(rdata.status){ // layer.closeAll(); // } // layer.msg(rdata.msg,{icon:rdata.status?1:2}); // }); // } function SavePanelSSL(option) { option = option || { loading: true }; var privateKey = $("#key").val().trim(); var certPem = $("#csr").val().trim(); if (privateKey === 'false') return layer.msg('Please paste your Private key (KEY) here', {icon: 2}); if (certPem === 'false') return layer.msg('Please paste your Certificate (CRT/PEM) here', {icon: 2}); var data = { privateKey: privateKey, certPem: certPem } var loadT; if (option.loading) { loadT = layer.msg(lan.config.ssl_msg, {icon: 16, time: 0, shade: [0.3, '#000']}); } $.post('/config?action=SavePanelSSL', data, function (rdata) { if (option.loading) layer.close(loadT); if (rdata.status) { if (option.callback) { option.callback(rdata); } else { layer.closeAll(); layer.msg(rdata.msg, {icon: 1}); } } else { layer.msg(rdata.msg, {icon: 2}); } }); } function SetDebug() { var status_s = {false: 'open', true: 'close'} var debug_stat = $("#panelDebug").prop('checked'); bt.confirm({ title: (debug_stat ? 'Open' : 'Close') + " developer mode", msg: "Do you confirm to " + (debug_stat ? 'open' : 'close') + " developer mode?", cancel: function () { $("#panelDebug").prop('checked', debug_stat); } }, function () { var loadT = layer.msg(lan.public.the, {icon: 16, time: 0, shade: [0.3, '#000']}); $.post('/config?action=set_debug', {}, function (rdata) { layer.close(loadT); if (rdata.status) layer.closeAll() layer.msg(rdata.msg, {icon: rdata.status ? 1 : 2}); }); }, function () { $("#panelDebug").prop('checked', debug_stat); }); } function set_local() { var status_s = { false: 'Open', true: 'Close' } var debug_stat = $("#panelLocal").prop('checked'); bt.confirm({ title: status_s[debug_stat] + "Offline mode", msg: "Do you really want "+ status_s[debug_stat] + "offline mode?", cancel: function () { $("#panelLocal").prop('checked',debug_stat); }}, function () { var loadT = layer.msg(lan.public.the, { icon: 16, time: 0, shade: [0.3, '#000'] }); $.post('/config?action=set_local', {}, function (rdata) { layer.close(loadT); if (rdata.status) layer.closeAll(); layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 }); }); },function () { $("#panelLocal").prop('checked',debug_stat); }); } if(window.location.protocol.indexOf('https') != -1){ $("#panelSSL").prop('checked',true); } var weChat = { settiming:'', relHeight:500, relWidth:500, userLength:'', init:function(){ var _this = this; $('.layui-layer-page').css('display', 'none'); $('.layui-layer-page').width(_this.relWidth); $('.layui-layer-page').height(_this.relHeight); $('.bt-w-menu').height((_this.relWidth - 1) - $('.layui-layer-title').height()); var width = $(document).width(); var height = $(document).height(); var boxwidth = (width / 2) - (_this.relWidth / 2); var boxheight = (height / 2) - (_this.relHeight / 2); $('.layui-layer-page').css({ 'left':boxwidth +'px', 'top':boxheight+'px' }); $('.boxConter,.layui-layer-page').css('display', 'block'); $('.layui-layer-close').click(function(event) { window.clearInterval(_this.settiming); }); this.getUserDetails(); $('.iconCode').hide(); $('.personalDetails').show(); }, // 获取二维码 getQRCode:function(){ var _this = this; var qrLoading = layer.msg(lan.config.get_qr_core,{time:0,shade: [0.4,'#fff'],icon:16}); $.get('/wxapp?action=blind_qrcode', function(res) { layer.close(qrLoading); if (res.status){ $('#QRcode').empty(); $('#QRcode').qrcode({ render: "canvas", //也可以替换为table width: 200, height: 200, text:res.msg }); // $('.QRcode img').attr('src', res.msg); _this.settiming = setInterval(function(){ _this.verifyBdinding(); },2000); }else{ layer.msg(lan.config.get_qr_core_fail,{icon:2}); } }); }, // 获取用户信息 getUserDetails:function(type){ var _this = this; var conter = ''; $.get('/wxapp?action=get_user_info',function(res){ clearInterval(_this.settiming); if (!res.status){ layer.msg(res.msg,{icon:2,time:3000}); $('.iconCode').hide(); return false; } if (JSON.stringify(res.msg) =='{}'){ if (type){ layer.msg(lan.config.qrcode_no_list,{icon:2}); }else{ _this.getQRCode(); } $('.iconCode').show(); $('.personalDetails').hide(); return false; } $('.iconCode').hide(); $('.personalDetails').show(); var datas = res.msg; for(var item in datas){ conter += '
  • \
    \
    '+lan.config.nikename+':'+datas[item].nickName+'
    \
    \ '+lan.config.unbind+'\
    \
  • ' } conter += '
  • '+lan.config.add_bind_account+'
  • ' $('.userList').empty().append(conter); }); }, // 添加绑定视图 addweChatView:function(){ $('.iconCode').show(); $('.personalDetails').hide(); this.getQRCode(); }, // 取消当前绑定 cancelBdinding:function(uid){ var _this = this; var bdinding = layer.confirm(lan.config.confirm_unbind,{ btn:[lan.config.confirm,lan.config.cancel], icon:3, title:lan.config.unbind },function(){ $.get('/wxapp?action=blind_del',{uid:uid}, function(res) { layer.msg(res.msg,{icon:res.status?1:2}); _this.getUserDetails(); }); },function(){ layer.close(bdinding); }); }, // 监听是否绑定 verifyBdinding:function(){ var _this = this; $.get('/wxapp?action=blind_result',function(res){ if(res){ layer.msg(lan.config.bind_success,{icon:1}); clearInterval(_this.settiming); _this.getUserDetails(); } }); }, } function open_wxapp(){ var rhtml = '' layer.open({ type: 1, title: lan.config.bind_wechat, area: '500px', closeBtn: 2, shadeClose: false, content:rhtml }); weChat.init(); } $(function () { $.get("/ssl?action=GetUserInfo", function (b) { if (b.status) { $("input[name='btusername']").val(b.data.username); $("input[name='btusername']").next().text(lan.public.edit).attr("onclick", "bindBTName(2,'c')").css({ "right": "57px" }); $("input[name='btusername']").next().after('' + lan.config.binding_un + ''); } else { $("input[name='btusername']").next().text(lan.config.binding).attr("onclick", "bindBTName(2,'b')").removeAttr("style"); } bt_init(); }); }) function bt_init() { var btName = $("input[name='btusername']").val(); //console.log(btName); if (!btName) { $('.wxapp_p .inputtxt').val(lan.config.no_bind_bt_account); $('.wxapp_p .modify').attr("onclick", ""); } } function GetPanelApi() { var loadT = layer.msg(lan.config.get_api, { icon: 16, time: 0, shade: [0.3, '#000'] }); $.post('/config?action=get_token', {}, function (rdata) { layer.close(loadT); isOpen = rdata.open ? 'checked' : ''; layer.open({ type: 1, area: "522px", title: lan.config.set_api, closeBtn: 2, shift: 5, shadeClose: false, content: '
    \
    \ '+lan.config.api+'\
    \ \ \
    \
    \
    \ '+lan.config.int_sk+'\
    \ \ \
    \
    \
    \ '+lan.config.ip_white_list+'
    ('+lan.config.one_per_line+')
    \
    \ \ \
    \
    \ \
    ' }) }); } function showPawApi(){ layer.msg('The panel API key only supports one-time display, please keep it safe.
    To display the panel API key, click the reset button to regain the new API key.
    Note: After the key is reset, the associated key product will be invalid. Please re-add the new key to the product.',{icon:0,time:0,shadeClose:true,shade:0.1}); } function SetPanelApi(t_type,index) { var pdata = {} pdata['t_type'] = t_type if (t_type == 3) { pdata['limit_addr'] = $("textarea[name='api_limit_addr']").val() } if(t_type == 1){ var bdinding = layer.confirm('Are you sure you want to reset your current key?
    After the key is reset, the associated key product will be invalid. Please re-add the new key to the product.',{ btn:['Confirm','Cancel'], icon:3, closeBtn: 2, title:'Reset key' },function(){ var loadT = layer.msg(lan.config.is_submitting, { icon: 16, time: 0, shade: [0.3, '#000'] }); set_token_req(pdata,function(rdata){ if (rdata.status) { $("input[name='panel_token_value']").val(rdata.msg); layer.msg(lan.config.create_int_key_success, { icon: 1, time: 0, shade: 0.3, shadeClose:true,closeBtn:2}); }else{ layer.msg(rdata.msg, { icon: 2}); } return false; }); }); return false } set_token_req(pdata,function(rdata){ layer.close(layer.index); if (rdata.msg == 'Open success!') { if(t_type == 2 && index != '1') GetPanelApi(); } if(t_type == 2) $('#panelApi').prop('checked',rdata.msg == 'Open success!'?true:false); layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 }); }); } function set_token_req(pdata,callback){ $.post('/config?action=set_token', pdata, function (rdata) { if(callback) callback(rdata); }); } function SetIPv6() { var loadT = layer.msg(lan.config.setting_up, { icon: 16, time: 0, shade: [0.3, '#000'] }); $.post('/config?action=set_ipv6_status', {}, function (rdata) { layer.close(loadT); bt.msg(rdata); }); } function modify_basic_auth_to() { var pdata = { open: $("select[name='open']").val(), basic_user: $("input[name='basic_user']").val(), basic_pwd: $("input[name='basic_pwd']").val() } var loadT = layer.msg(lan.config.set_basicauth, { icon: 16, time: 0, shade: [0.3, '#000'] }); $.post('/config?action=set_basic_auth', pdata, function (rdata) { layer.close(loadT); if (rdata.status) { layer.closeAll(); setTimeout(function () { window.location.reload(); }, 3000); } layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 }); }); } function set_panel_report(){ if(!three_channel_status.user_mail.user_name) return layer.msg('Please set up the [ Notification ] first',{icon:2}) get_login_send(function(rdata){ layer.open({ type: 1, area:'700px', title: "Login panel alarm", closeBtn: 2, shift: 5, shadeClose: false, content: '
    \
    \
    \

    Alarm settings

    \

    IP whitelist

    \
    \
    \
    \
    \
    \
    \ Send to mailbox\
    \ \ \
    \
    \
    \
    \ \ \
    login infotime
    \
    \
    \
    \
    \
      \
    • xxxxxxxxxxxxxxxxxxx
    • \
    \
    \ \
    \
    \
    \
    ', success:function(index,layers){ get_log_table(); get_ip_write_table() $(".bt-w-menu p").click(function () { var index = $(this).index(); $(this).addClass('bgw').siblings().removeClass('bgw'); console.log(index,'111'); switch(index){ case 0: get_log_table(); break; case 1: get_ip_write_table() break; } $('.conter_box').eq(index).show().siblings().hide(); }); //设置告警 $('#mail').on('click',function(){ var _checked = $(this).prop('checked'); if(_checked){ $.post('/config?action=set_login_send',{type:'mail'},function(res){ layer.msg(res.msg,{icon:res.status?1:2}); }); }else{ $.post('/config?action=clear_login_send',{type:'mail'},function(res){ layer.msg(res.msg,{icon:res.status?1:2}); }); } }); //添加 $('.add_ip_write').on('click',function(){ var _ip = $('[name="ip_write"]').val(); if(!bt.check_ip(_ip)) return layer.msg('Please enter the correct IP',{icon:2}) login_ipwhite({ip:_ip,type:'add'},function(res){ if(res.status) get_ip_write_table() layer.msg(res.msg,{icon:res.status?1:2}); }) }) //删除ip白名单 $('#ip_write_table').on('click','.del_ip_write',function(){ var _ip = $(this).parents('tr').data().data; login_ipwhite({ip:_ip,type:'del'},function(res){ if(res.status) get_ip_write_table() layer.msg(res.msg,{icon:res.status?1:2}); }) }); //清空全部 $('.clear_all').on('click',function(){ layer.confirm('Whether to clear the IP whitelist', {title:'Tips',btn: ['Confirm','Cancel'],icon:0,closeBtn:2}, function() { login_ipwhite({type:'clear'},function(res){ if(res.status) get_ip_write_table() layer.msg(res.msg,{icon:res.status?1:2}); }) }) }) //分页操作 $('#server_table_page').on('click','a',function(e){ e.stopPropagation(); e.preventDefault(); var _p = $(this).attr('href').match(/p=([0-9]*)/)[1]; get_log_table({p:_p}); }) }, cancel:function(){ $('#panel_report').val( $('#mail').prop('checked') ? 'Already set' : 'Not set'); } }) }) } function get_log_table(obj){ if(!obj) obj = {p:1} var loadT = bt.load('Getting Logs list, please wait') $.post('/config?action=get_login_log',obj,function(res){ loadT.close() $('#server_table').empty() if(res.data.length > 0){ $.each(res.data,function(index,item){ $('#server_table').append($('\ '+ item.log +'\ '+ item.addtime +'\ ').data({data:item,index:index})) }); }else{ $('#server_table').html('None Data') } $('#server_table_page').html(res.page) }); } function get_ip_write_table(){ $('#ip_write_table').empty() login_ipwhite({type:'get'},function(res){ if(res.msg.length > 0){ $.each(res.msg,function(index,item){ $('#ip_write_table').append($('\ '+ item +'\ \ Del\ \ ').data({data:item,index:index})) }); }else{ $('#ip_write_table').html('None Data') } }) } function modify_basic_auth() { var loadT = layer.msg(lan.config.setting_basicauth, { icon: 16, time: 0, shade: [0.3, '#000'] }); $.post('/config?action=get_basic_auth_stat', {}, function (rdata) { layer.close(loadT); if (rdata.open) { show_basic_auth(rdata); } else { m_html = '
    ' + '

    Warning! Do not understand this feature, do not open!

    ' + '
    ' + '
    ' + '' + 'What is BasicAuth authentication?

    ' var loadT = layer.confirm(m_html, { title: "Risk reminder", area: "600px",closeBtn:2 }, function () { if (!$("#check_basic").prop("checked")) { layer.msg("Please read the precautions carefully and check to agree to take risks!"); setTimeout(function () { modify_basic_auth();},3000) return; } layer.close(loadT) show_basic_auth(rdata); }); } }); } function show_basic_auth(rdata) { layer.open({ type: 1, area: "500px", title: "Configure BasicAuth authentication", closeBtn: 2, shift: 5, shadeClose: false, content: '
    \
    \ '+lan.public.server_status+'\
    \ \
    \
    \
    \ '+lan.public.username+'\
    \ \
    \
    \
    \ '+lan.public.pass+'\
    \ \
    \
    \ \ \
    ' }) } function get_panel_hide_list(){ var loadT = bt.load('Getting panel menu bar, please wait...'),arry = []; $.post('/config?action=get_menu_list',function(rdata){ loadT.close(); $.each(rdata,function(index,item){ if(!item.show) arry.push(item.title) }); $('#panel_menu_hide').val(arry.length > 0?arry.join('/'):'No hidden bar'); }); } get_panel_hide_list(); // 设置面板菜单显示功能 function set_panel_ground(){ var loadT = bt.load('Getting panel menu bar, please wait...'); $.post('/config?action=get_menu_list',function(rdata){ var html = '',arry = ["dologin","memuAconfig","memuAsoft","memuA"],is_option = ''; loadT.close(); $.each(rdata,function(index,item){ is_option = '
    ' if(item.id == 'dologin' || item.id == 'memuAconfig' || item.id == 'memuAsoft' || item.id == 'memuA') is_option = 'Inoperable'; html += ''+ item.title +'
    '+ is_option +'
    '; }); layer.open({ type:1, title:'Manage panel menu bar', area:['350px','536px'], shadeClose:false, closeBtn:2, content:'
    '+ html +'
    Menu barDisplay
    ', success:function(){ $('#panel_menu_tab input').click(function(){ var arry = []; $(this).parents('tr').siblings().each(function(index,el){ if($(this).find('input').length >0 && !$(this).find('input').prop('checked')){ arry.push($(this).find('input').attr('name')); } }); if(!$(this).prop('checked')){ arry.push($(this).attr('name')); } var loadT = bt.load('Setting panel menu bar display status, please wait...'); $.post('/config?action=set_hide_menu_list',{hide_list:JSON.stringify(arry)},function(rdata){ loadT.close(); bt.msg(rdata); }); }); } }); }); } /** * @description 获取临时授权列表 * @param {Function} callback 回调函数列表 * @returns void */ function get_temp_login(data,callback){ var loadT = bt.load('Get temporary authorization list, please wait...'); bt.send('get_temp_login','config/get_temp_login',data,function(res){ if(res.status === false){ layer.closeAll(); bt.msg(res); return false; } loadT.close(); if(callback) callback(res) }); } /** * @description 设置临时链接 * @param {Function} callback 回调函数列表 * @returns void */ function set_temp_login(callback){ var loadT = bt.load('Setting temporary links, please wait...'); bt.send('set_temp_login','config/set_temp_login',{},function(res){ loadT.close(); if(callback) callback(res) }); } /** * @description 设置临时链接 * @param {Object} data 传入参数,id * @param {Function} callback 回调函数列表 * @returns void */ function remove_temp_login(data,callback){ var loadT = bt.load('Deleting temporary authorization record, please wait...'); bt.send('remove_temp_login','config/remove_temp_login',{id:data.id},function(res){ loadT.close(); if(callback) callback(res) }); } /** * @description 强制用户登出 * @param {Object} data 传入参数,id * @param {Function} callback 回调函数列表 * @returns void */ function clear_temp_login(data,callback){ var loadT = bt.load('Forcing user to log out, please wait...'); bt.send('clear_temp_login','config/clear_temp_login',{id:data.id},function(res){ loadT.close(); if(callback) callback(res) }); } /** * @description 渲染授权管理列表 * @param {Object} data 传入参数,id * @param {Function} callback 回调函数列表 * @returns void */ function reader_temp_list(data,callback){ if(typeof data == 'function') callback = data,data = {p:1}; get_temp_login(data,function(rdata){ var html = ''; $.each(rdata.data,function(index,item){ html += ''+ (item.login_addr || 'Not login') +''+ (function(){ switch(item.state){ case 0: return 'Not login'; break; case 1: return 'Logged in'; break; case -1: return 'Expired'; break; } }()) +''+ (item.login_time == 0?'Not login':bt.format_data(item.login_time)) +''+ bt.format_data(item.expire) +''+ (function(){ if(item.state != 1){ return 'Del'; } if(item.online_state){ return 'Force logout   |  Logs'; } return 'Logs'; }()) +''; }); $('#temp_login_view_tbody').html(html); $('.temp_login_view_page').html(rdata.page); if(callback) callback() }); } /** * @description 获取操作日志 * @param {Object} data 传入参数,id * @param {Function} callback 回调函数列表 * @returns void */ function get_temp_login_logs(data,callback){ var loadT = bt.load('Getting operation log, please wait...'); bt.send('clear_temp_login','config/get_temp_login_logs',{id:data.id},function(res){ loadT.close(); if(callback) callback(res) }); } /** * @description 渲染操作日志 * @param {Object} data 传入参数,id * @param {Function} callback 回调函数列表 * @returns void */ function reader_temp_login_logs(data,callback){ get_temp_login_logs(data,function(res){ var html = ''; $.each(res,function(index,item){ html += ''+ item.type +''+ item.addtime +''+ item.log +''; }); if(callback) callback({tbody:html,data:res}); }) } /** * @description 设置临时链接 * @param {Function} callback 回调函数列表 * @returns void */ function get_temp_login_view(){ layer.open({ type: 1, area:["700px",'600px'], title: "Temporary authorization management", closeBtn: 2, shift: 5, shadeClose: false, content:'
    '+ ''+ '
    '+ ''+ ''+ ''+ '
    Login IPStatusLogin timeExpiration timeOpt
    '+ ''+ '
    '+ '
    ', success:function(){ reader_temp_list(); // 创建临时授权 $('.create_temp_login').click(function(){ bt.confirm({title:'Risk tips',msg:'Note 1: Abuse of temporary authorization may lead to security risks.
    Note 2: Not publish temporary authorized connections in public

    Temporary authorization connection is about to be created. Continue?'},function(){ layer.open({ type: 1, area:'570px', title: "Create temporary authorization", closeBtn: 2, shift: 5, shadeClose: false, content:'
    '+ '
    Temporary authorized address
    '+ '
    '+ ''+ '
    ', success:function(){ set_temp_login(function(res){ if(res.status){ var temp_link = location.origin+ '/login?tmp_token=' + res.token; $('#temp_link').val(temp_link); $('.btn-copy-temp-link').attr('data-clipboard-text',temp_link); } }); var clipboard = new ClipboardJS('.btn'); clipboard.on('success', function(e) { bt.msg({status:true,msg:'Copy succeeded!'}); e.clearSelection(); }); clipboard.on('error', function(e) { bt.msg({status:false,msg:'Copy failed, please copy address manually'}); }); }, end:function(){ reader_temp_list(); } }); }); }); // 操作日志 $('#temp_login_view_tbody').on('click','.logs_temp_login',function(){ var id = $(this).data('id'),ip = $(this).data('ip'); layer.open({ type: 1, area:['700px','550px'], title:'Operation logs ['+ ip +']', closeBtn: 2, shift: 5, shadeClose: false, content:'
    '+ ''+ '
    '+ ''+ ''+ ''+ '
    OperationTimelogs
    '+ '
    '+ '
    ', success:function(){ reader_temp_login_logs({id:id},function(data){ $('#logs_login_view_table tbody').html(data.tbody); }); $('.refresh_login_logs').click(function(){ reader_temp_login_logs({id:id},function(data){ $('#logs_login_view_table tbody').html(data.tbody); }); }); bt.fixed_table('logs_login_view_table'); } }); }); //删除授权记录,仅未使用的授权记录 $('#temp_login_view_tbody').on('click','.remove_temp_login',function(){ var id = $(this).data('id'); bt.confirm({ title:'Remove unused licenses', msg:'Delete unused authorization record, continue?' },function(){ remove_temp_login({id:id},function(res){ reader_temp_list(function(){ bt.msg(res); }) }) }) }); //强制下线,强制登录的用户下线 $('#temp_login_view_tbody').on('click','.clear_temp_login',function(){ var id = $(this).data('id'),ip= $(this).data('ip'); bt.confirm({ title:'Force logout [ '+ ip +' ]', msg:'Confirm to force logout [ '+ ip +' ]?' },function(){ clear_temp_login({id:id},function(res){ reader_temp_list(function(){ bt.msg(res); }); }); }) }); // 分页操作 $('.temp_login_view_page').on('click','a',function(ev){ var href = $(this).attr('href'),reg = /([0-9]*)$/,page = reg.exec(href)[0]; reader_temp_list({p:page}); ev.stopPropagation(); ev.preventDefault(); }); } }); }