Skip to content

Commit

Permalink
web user auth bug
Browse files Browse the repository at this point in the history
  • Loading branch information
刘河 committed Mar 27, 2019
1 parent b43abb4 commit b09d3ec
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
8 changes: 5 additions & 3 deletions web/controllers/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 2 additions & 0 deletions web/views/client/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ <h3 class="ibox-title">add client</h3>
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">
Expand All @@ -36,6 +37,7 @@ <h3 class="ibox-title">add client</h3>
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">
Expand Down
10 changes: 5 additions & 5 deletions web/views/client/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ <h5>client list</h5>
},
{
field: 'Status',//域值
title: 'setting status',//内容
title: 'run',//内容
visible: true,//false表示不显示
sortable: true,//启用排序
formatter: function (value, row, index) {
Expand All @@ -210,7 +210,7 @@ <h5>client list</h5>
},
{
field: 'IsConnect',//域值
title: 'client status',//内容
title: 'status',//内容
visible: true,//false表示不显示
sortable: true,//启用排序
formatter: function (value, row, index) {
Expand All @@ -228,12 +228,12 @@ <h5>client list</h5>
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
}
}
},
Expand Down

0 comments on commit b09d3ec

Please sign in to comment.