pull/109/head
Mr Chen 6 years ago
parent 5d95790df2
commit 6e5b10cffe
  1. 14
      plugins/l2tp/index.py
  2. 2
      plugins/l2tp/js/l2tp.js

@ -110,8 +110,8 @@ def getUserList():
line = re.match(r'(\w*)\s*(\w*)\s*(\w*)\s*(.*)', line = re.match(r'(\w*)\s*(\w*)\s*(\w*)\s*(.*)',
line.strip(), re.M | re.I).groups() line.strip(), re.M | re.I).groups()
line_info['user'] = line[0] line_info['user'] = line[0]
line_info['pwd'] = line[1] line_info['pwd'] = line[2]
line_info['psk'] = line[2] line_info['type'] = line[1]
line_info['ip'] = line[3] line_info['ip'] = line[3]
user.append(line_info) user.append(line_info)
@ -123,8 +123,10 @@ def addUser():
data = checkArgs(args, ['username']) data = checkArgs(args, ['username'])
if not data[0]: if not data[0]:
return data[1] return data[1]
ret = public.execShell('echo ' + args['username'] + '|l2tp -a')
public.execShell('echo ' + args['username'] + '> ') if ret[0] == ''
return public.returnJson(True, '添加成功!')
return public.returnJson(False, '添加失败:' + ret[1])
def delUser(): def delUser():
@ -133,6 +135,10 @@ def delUser():
if not data[0]: if not data[0]:
return data[1] return data[1]
ret = public.execShell('echo ' + args['username'] + '|l2tp -l')
if ret[0] == ''
return public.returnJson(True, '删除成功!')
return public.returnJson(False, '删除失败:' + ret[1])
if __name__ == "__main__": if __name__ == "__main__":
func = sys.argv[1] func = sys.argv[1]
if func == 'status': if func == 'status':

@ -63,7 +63,6 @@ function userList(){
con += '<thead><tr>'; con += '<thead><tr>';
con += '<th>用户</th>'; con += '<th>用户</th>';
con += '<th>密码</th>'; con += '<th>密码</th>';
con += '<th>PSK</th>';
con += '<th>操作(<a class="btlink" onclick="addUser()">添加</a>)</th>'; con += '<th>操作(<a class="btlink" onclick="addUser()">添加</a>)</th>';
con += '</tr></thead>'; con += '</tr></thead>';
@ -73,7 +72,6 @@ function userList(){
con += '<tr>'+ con += '<tr>'+
'<td>' + list[i]['user']+'</td>' + '<td>' + list[i]['user']+'</td>' +
'<td>' + list[i]['pwd']+'</td>' + '<td>' + list[i]['pwd']+'</td>' +
'<td>' + list[i]['psk']+'</td>' +
'<td><a class="btlink" onclick="modPwd()">改密</a>|<a class="btlink" onclick="delUser(\''+list[i]['user']+'\')">删除</a></td></tr>'; '<td><a class="btlink" onclick="modPwd()">改密</a>|<a class="btlink" onclick="delUser(\''+list[i]['user']+'\')">删除</a></td></tr>';
} }

Loading…
Cancel
Save