aboutsummaryrefslogtreecommitdiff
path: root/modules/middleware/context.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/middleware/context.go')
-rw-r--r--modules/middleware/context.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/middleware/context.go b/modules/middleware/context.go
index c45206a9..cbc0b0cf 100644
--- a/modules/middleware/context.go
+++ b/modules/middleware/context.go
@@ -53,6 +53,7 @@ type Context struct {
GitRepo *git.Repository
BranchName string
TagName string
+ TreeName string
CommitId string
RepoLink string
CloneLink struct {
@@ -171,12 +172,16 @@ func Contexter() macaron.Handler {
ctx.Data["PageStartTime"] = time.Now()
// Get user from session if logined.
- ctx.User = auth.SignedInUser(ctx.Req.Header, ctx.Session)
+ ctx.User = auth.SignedInUser(ctx.Req.Request, ctx.Session)
+
if ctx.User != nil {
ctx.IsSigned = true
ctx.Data["IsSigned"] = ctx.IsSigned
ctx.Data["SignedUser"] = ctx.User
+ ctx.Data["SignedUserName"] = ctx.User.Name
ctx.Data["IsAdmin"] = ctx.User.IsAdmin
+ } else {
+ ctx.Data["SignedUserName"] = ""
}
// If request sends files, parse them here otherwise the Query() can't be parsed and the CsrfToken will be invalid.