From 694ebc54774f8fbd9e1bd5f7a04ce69bb9377e8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=B2=B3?= Date: Mon, 8 Apr 2019 17:07:59 +0800 Subject: [PATCH] useranme --- web/controllers/base.go | 1 + web/controllers/login.go | 1 + web/views/public/layout.html | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/web/controllers/base.go b/web/controllers/base.go index 6c0bfe2..5308d35 100755 --- a/web/controllers/base.go +++ b/web/controllers/base.go @@ -39,6 +39,7 @@ func (s *BaseController) Prepare() { s.Ctx.Input.SetData("client_id", s.GetSession("clientId").(int)) s.Ctx.Input.SetParam("client_id", strconv.Itoa(s.GetSession("clientId").(int))) s.Data["isAdmin"] = false + s.Data["username"] = s.GetSession("username") s.CheckUserAuth() } else { s.Data["isAdmin"] = true diff --git a/web/controllers/login.go b/web/controllers/login.go index 3c8cec9..7b8a55d 100755 --- a/web/controllers/login.go +++ b/web/controllers/login.go @@ -43,6 +43,7 @@ func (self *LoginController) Verify() { if auth { self.SetSession("isAdmin", false) self.SetSession("clientId", v.Id) + self.SetSession("username", v.WebUserName) return false } return true diff --git a/web/views/public/layout.html b/web/views/public/layout.html index 8a4bcc5..4d4caf3 100755 --- a/web/views/public/layout.html +++ b/web/views/public/layout.html @@ -42,7 +42,7 @@ {{if eq true .isAdmin}} admin {{else}} - user + {{.username}} {{end}} system