Compare commits

...
3 Commits
Author SHA1 Message Date
刘河 3d30f7a4b0 Version 2019-03-27 10:06:52 +08:00
刘河 b09d3ec22c web user auth bug 2019-03-27 10:06:10 +08:00
刘河 b43abb4b5d web api 2019-03-27 01:06:15 +08:00
5 changed files with 15 additions and 10 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
package version
const VERSION = "0.20.1"
const VERSION = "0.20.2"
// Compulsory minimum version, Minimum downward compatibility to this version
func GetVersion() string {
+2 -1
View File
@@ -6,6 +6,7 @@ import (
"github.com/cnlh/nps/lib/file"
"github.com/cnlh/nps/server"
"github.com/cnlh/nps/vender/github.com/astaxie/beego"
"math"
"strconv"
"strings"
"time"
@@ -29,7 +30,7 @@ func (s *BaseController) Prepare() {
timestamp := s.GetIntNoErr("timestamp")
configKey := beego.AppConfig.String("auth_key")
timeNowUnix := time.Now().Unix()
if !(((timeNowUnix - int64(timestamp)) <= 20) && ((timeNowUnix - int64(timestamp)) >= -20) && (crypt.Md5(configKey+strconv.Itoa(timestamp)) == md5Key)) {
if !((math.Abs(float64(timeNowUnix-int64(timestamp))) <= 20) && (crypt.Md5(configKey+strconv.Itoa(timestamp)) == md5Key)) {
if s.GetSession("auth") != true {
s.Redirect("/login/index", 302)
}
+5 -3
View File
@@ -107,9 +107,11 @@ func (s *ClientController) Edit() {
c.Cnf.P = s.GetString("p")
c.Cnf.Compress = common.GetBoolByStr(s.GetString("compress"))
c.Cnf.Crypt = s.GetBoolNoErr("crypt")
c.Flow.FlowLimit = int64(s.GetIntNoErr("flow_limit"))
c.RateLimit = s.GetIntNoErr("rate_limit")
c.MaxConn = s.GetIntNoErr("max_conn")
if s.GetSession("isAdmin").(bool) {
c.Flow.FlowLimit = int64(s.GetIntNoErr("flow_limit"))
c.RateLimit = s.GetIntNoErr("rate_limit")
c.MaxConn = s.GetIntNoErr("max_conn")
}
c.ConfigConnAllow = s.GetBoolNoErr("config_conn_allow")
if c.Rate != nil {
c.Rate.Stop()
+2
View File
@@ -12,6 +12,7 @@
placeholder="remark">
</div>
</div>
{{if eq true .isAdmin}}
<div class="form-group" id="flow_limit">
<label class="col-sm-2 control-label" langtag="info-flow-limit">流量限制</label>
<div class="col-sm-10">
@@ -36,6 +37,7 @@
placeholder="empty means to be unrestricted">
</div>
</div>
{{end}}
<div class="form-group" id="u">
<label class="control-label col-sm-2" langtag="info-web-auth-username">basic权限认证用户名</label>
<div class="col-sm-10">
+5 -5
View File
@@ -197,7 +197,7 @@
},
{
field: 'Status',//域值
title: 'setting status',//内容
title: 'run',//内容
visible: true,//false表示不显示
sortable: true,//启用排序
formatter: function (value, row, index) {
@@ -210,7 +210,7 @@
},
{
field: 'IsConnect',//域值
title: 'client status',//内容
title: 'status',//内容
visible: true,//false表示不显示
sortable: true,//启用排序
formatter: function (value, row, index) {
@@ -228,12 +228,12 @@
sortable: true,//启用排序
formatter: function (value, row, index) {
btn_group = '<div class="btn-group">'
btn = ` {{if eq true .isAdmin}}<button onclick="del(` + row.Id + `)" class="btn-danger"><i class="fa fa-trash"></i></button>{{end}}<button onclick="edit(` + row.Id + `)" class="btn-primary"><i class="fa fa-edit"></i></button></div>`
btn = `{{if eq true .isAdmin}}<button onclick="del(` + row.Id + `)" class="btn-danger"><i class="fa fa-trash"></i></button>{{end}}<button onclick="edit(` + row.Id + `)" class="btn-primary"><i class="fa fa-edit"></i></button></div>`
if (row.Status) {
return btn_group {{if eq true .isAdmin}}+ `<button onclick="stop(` + row.Id + `)" class="btn-warning"><i class="fa fa-close"></i></button>` {{end}}+ btn
return btn_group {{if eq true .isAdmin}}+ `<button onclick="stop(` + row.Id + `)" class="btn-warning"><i class="fa fa-close"></i></button>`{{end}}+ btn
} else {
return btn_group {{if eq true .isAdmin}}+ `<button onclick="start(` + row.Id + `)" class="btn-warning"><i class="fa fa-check"></i></button>` {{end}}+ btn
return btn_group {{if eq true .isAdmin}}+ `<button onclick="start(` + row.Id + `)" class="btn-warning"><i class="fa fa-check"></i></button>`{{end}}+ btn
}
}
},