From 743fee60158edb5815b86504db29b268f29e1cbf Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 24 Mar 2014 12:43:51 -0400 Subject: [PATCH] Fix --- routers/dashboard.go | 9 +++++++++ templates/repo/single_file.tmpl | 14 +++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/routers/dashboard.go b/routers/dashboard.go index 76ecc3f67..2c81cf23c 100644 --- a/routers/dashboard.go +++ b/routers/dashboard.go @@ -5,6 +5,7 @@ package routers import ( + "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/middleware" "github.com/gogits/gogs/routers/user" ) @@ -14,6 +15,14 @@ func Home(ctx *middleware.Context) { user.Dashboard(ctx) return } + + // Check auto-login. + userName := ctx.GetCookie(base.CookieUserName) + if len(userName) != 0 { + ctx.Redirect("/user/login") + return + } + ctx.Data["PageIsHome"] = true ctx.HTML(200, "home") } diff --git a/templates/repo/single_file.tmpl b/templates/repo/single_file.tmpl index 45586012b..6c7e5650a 100644 --- a/templates/repo/single_file.tmpl +++ b/templates/repo/single_file.tmpl @@ -6,14 +6,14 @@ {{else}} {{.FileName}} {{FileSize .FileSize}} -
- - Raw - - - -
{{end}} +
+ + Raw + + + +
{{if not .FileIsText}}