Unknown 11 anni fa
parent
commit
743fee6015
2 ha cambiato i file con 16 aggiunte e 7 eliminazioni
  1. 9 0
      routers/dashboard.go
  2. 7 7
      templates/repo/single_file.tmpl

+ 9 - 0
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")
 }

+ 7 - 7
templates/repo/single_file.tmpl

@@ -6,14 +6,14 @@
         {{else}}
             <i class="icon fa fa-file-text-o"></i>
             {{.FileName}} <span class="file-size">{{FileSize .FileSize}}</span>
-            <div class="btn-group pull-right">
-                <a class="btn btn-default hidden" href="#">Edit</a>
-                <a class="btn btn-default" href="{{.FileLink}}">Raw</a>
-                <a class="btn btn-default hidden" href="#">Blame</a>
-                <a class="btn btn-default hidden" href="#">History</a>
-                <a class="btn btn-danger hidden" href="#">Delete</a>
-            </div>
         {{end}}
+        <div class="btn-group pull-right">
+            <a class="btn btn-default hidden" href="#">Edit</a>
+            <a class="btn btn-default" href="{{.FileLink}}">Raw</a>
+            <a class="btn btn-default hidden" href="#">Blame</a>
+            <a class="btn btn-default hidden" href="#">History</a>
+            <a class="btn btn-danger hidden" href="#">Delete</a>
+        </div>
     </div>
     {{if not .FileIsText}}
         <div class="panel-footer text-center">