summaryrefslogtreecommitdiffstats
path: root/modules/middleware/auth.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/middleware/auth.go')
-rw-r--r--modules/middleware/auth.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/middleware/auth.go b/modules/middleware/auth.go
index cd00d4679e..e208fb017e 100644
--- a/modules/middleware/auth.go
+++ b/modules/middleware/auth.go
@@ -6,6 +6,7 @@ package middleware
import (
"net/url"
+ "strings"
"github.com/go-martini/martini"
@@ -40,6 +41,10 @@ func Toggle(options *ToggleOptions) martini.Handler {
if options.SignInRequire {
if !ctx.IsSigned {
+ // Ignore watch repository operation.
+ if strings.HasSuffix(ctx.Req.RequestURI, "watch") {
+ return
+ }
ctx.SetCookie("redirect_to", "/"+url.QueryEscape(ctx.Req.RequestURI))
ctx.Redirect("/user/login")
return