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.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/modules/middleware/auth.go b/modules/middleware/auth.go
index 3224b3df91..82c3367c48 100644
--- a/modules/middleware/auth.go
+++ b/modules/middleware/auth.go
@@ -5,6 +5,8 @@
package middleware
import (
+ "net/url"
+
"github.com/codegangsta/martini"
"github.com/gogits/gogs/modules/base"
@@ -35,6 +37,7 @@ func Toggle(options *ToggleOptions) martini.Handler {
if options.SignInRequire {
if !ctx.IsSigned {
+ ctx.SetCookie("redirect_to", "/"+url.QueryEscape(ctx.Req.RequestURI))
ctx.Redirect("/user/login")
return
} else if !ctx.User.IsActive && base.Service.RegisterEmailConfirm {