Bläddra i källkod

web user auth bug

刘河 6 år sedan
förälder
incheckning
b09d3ec22c
3 ändrade filer med 12 tillägg och 8 borttagningar
  1. 5 3
      web/controllers/client.go
  2. 2 0
      web/views/client/edit.html
  3. 5 5
      web/views/client/list.html

+ 5 - 3
web/controllers/client.go

@@ -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 - 0
web/views/client/edit.html

@@ -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
web/views/client/list.html

@@ -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
                     }
                 }
             },