diff options
author | slene <vslene@gmail.com> | 2014-03-15 20:50:17 +0800 |
---|---|---|
committer | slene <vslene@gmail.com> | 2014-03-15 20:50:17 +0800 |
commit | 9cdded911b62825e448ee9e94b0b534351d4b3d8 (patch) | |
tree | 4bb9f5be7f153d211f8ce236fb873a1600669c7c /modules | |
parent | c7acb9552a47786ef7f6d8add6f8807f4a790c6e (diff) | |
download | gitea-9cdded911b62825e448ee9e94b0b534351d4b3d8.tar.gz gitea-9cdded911b62825e448ee9e94b0b534351d4b3d8.zip |
fix context
Diffstat (limited to 'modules')
-rw-r--r-- | modules/middleware/context.go | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/modules/middleware/context.go b/modules/middleware/context.go index 5ca726d93e..3167823794 100644 --- a/modules/middleware/context.go +++ b/modules/middleware/context.go @@ -60,12 +60,15 @@ func InitContext() martini.Handler { // Get user from session if logined. user := auth.SignedInUser(session) ctx.User = user - ctx.IsSigned = ctx != nil + ctx.IsSigned = user != nil - data["IsSigned"] = true - data["SignedUser"] = user - data["SignedUserId"] = user.Id - data["SignedUserName"] = user.LowerName + data["IsSigned"] = ctx.IsSigned + + if user != nil { + data["SignedUser"] = user + data["SignedUserId"] = user.Id + data["SignedUserName"] = user.LowerName + } c.Map(ctx) c.Map(data) |