mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-10 04:19:26 +08:00
update
This commit is contained in:
+13
-3
@@ -149,10 +149,20 @@ def modUser():
|
||||
if not data[0]:
|
||||
return data[1]
|
||||
|
||||
ret = public.execShell('echo ' + args['username'] + '|l2tp -d')
|
||||
path = getPathFile()
|
||||
username = args['username']
|
||||
password = args['password']
|
||||
|
||||
# sed -i "/^\<${user}\>/d" /etc/ppp/chap-secrets
|
||||
# echo "${user} l2tpd ${pass} *" >> /etc/ppp/chap-secrets
|
||||
public.execShell("sed -i .bak '/^\(" + username + "\)/d' " + path)
|
||||
# print 'echo "' + username + " l2tpd " + password + " *\" >>"
|
||||
# + path
|
||||
ret = public.execShell("echo \"" + username +
|
||||
" l2tpd " + password + " *\" >>" + path)
|
||||
if ret[1] == '':
|
||||
return public.returnJson(True, '修改成功!:' + ret[0])
|
||||
return public.returnJson(False, '修改失败:' + ret[0])
|
||||
return public.returnJson(True, '修改成功!')
|
||||
return public.returnJson(False, '修改失败')
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -126,7 +126,7 @@ function modUser(username){
|
||||
area: '240px',
|
||||
content:"<div class='bt-form pd20 pb70 c6'>\
|
||||
<div class='version line'>\
|
||||
<div><input class='bt-input-text mr5 outline_no' type='text' name='password' style='height: 28px; border-radius: 3px;width: 200px;' placeholder='输入密码'></div>\
|
||||
<div><input class='bt-input-text mr5 outline_no' type='text' id='password' name='password' style='height: 28px; border-radius: 3px;width: 200px;' placeholder='输入密码'></div>\
|
||||
</div>\
|
||||
<div class='bt-form-submit-btn'>\
|
||||
<button type='button' id='mod_ok' class='btn btn-success btn-sm btn-title bi-btn'>确认</button>\
|
||||
@@ -139,7 +139,7 @@ function modUser(username){
|
||||
_data['username'] = username;
|
||||
_data['password'] = $('#password').val();
|
||||
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
|
||||
lpPost('add_user', _data, function(data){
|
||||
lpPost('mod_user', _data, function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
layer.close(loadOpen);
|
||||
layer.msg(rdata.msg,{icon:rdata.status?1:2,time:2000,shade: [0.3, '#000']});
|
||||
|
||||
@@ -784,24 +784,6 @@ mod_user(){
|
||||
}
|
||||
|
||||
|
||||
mod_user2(){
|
||||
if [ $1 == ''];then
|
||||
echo 'user name cannot be empty'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $2 == ''];then
|
||||
echo 'password cannot be empty'
|
||||
exit 1
|
||||
fi
|
||||
user=$1
|
||||
pass=$2
|
||||
sed -i "/^\<${user}\>/d" /etc/ppp/chap-secrets
|
||||
echo "${user} l2tpd ${pass} *" >> /etc/ppp/chap-secrets
|
||||
echo "Username ${user}'s password has been changed."
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Main process
|
||||
action=$1
|
||||
@@ -823,7 +805,7 @@ case ${action} in
|
||||
del_user
|
||||
;;
|
||||
-m|--mod)
|
||||
mod_user2
|
||||
mod_user
|
||||
;;
|
||||
-h|--help)
|
||||
echo "Usage: `basename $0` -l,--list List all users"
|
||||
|
||||
Reference in New Issue
Block a user