mirror of https://github.com/ehang-io/nps
useranme
parent
824b12a2f8
commit
694ebc5477
|
@ -39,6 +39,7 @@ func (s *BaseController) Prepare() {
|
||||||
s.Ctx.Input.SetData("client_id", s.GetSession("clientId").(int))
|
s.Ctx.Input.SetData("client_id", s.GetSession("clientId").(int))
|
||||||
s.Ctx.Input.SetParam("client_id", strconv.Itoa(s.GetSession("clientId").(int)))
|
s.Ctx.Input.SetParam("client_id", strconv.Itoa(s.GetSession("clientId").(int)))
|
||||||
s.Data["isAdmin"] = false
|
s.Data["isAdmin"] = false
|
||||||
|
s.Data["username"] = s.GetSession("username")
|
||||||
s.CheckUserAuth()
|
s.CheckUserAuth()
|
||||||
} else {
|
} else {
|
||||||
s.Data["isAdmin"] = true
|
s.Data["isAdmin"] = true
|
||||||
|
|
|
@ -43,6 +43,7 @@ func (self *LoginController) Verify() {
|
||||||
if auth {
|
if auth {
|
||||||
self.SetSession("isAdmin", false)
|
self.SetSession("isAdmin", false)
|
||||||
self.SetSession("clientId", v.Id)
|
self.SetSession("clientId", v.Id)
|
||||||
|
self.SetSession("username", v.WebUserName)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
{{if eq true .isAdmin}}
|
{{if eq true .isAdmin}}
|
||||||
admin
|
admin
|
||||||
{{else}}
|
{{else}}
|
||||||
user
|
{{.username}}
|
||||||
{{end}}
|
{{end}}
|
||||||
</strong>
|
</strong>
|
||||||
</span> <span class="text-muted text-xs block">system </span> </span>
|
</span> <span class="text-muted text-xs block">system </span> </span>
|
||||||
|
|
Loading…
Reference in New Issue