aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-08-27 15:07:02 -0700
committerUnknwon <u@gogs.io>2016-08-27 15:07:02 -0700
commitf0b5c3b90a9ca4ef7c4759d49e91b3da80ff9c72 (patch)
tree55cdf9b4d89950c64ae3b00fa67926f9c5929d5d
parentc30b856d147dd895507c8f2334a11ed4baab6c18 (diff)
#3448 redirect if any after sign in
-rw-r--r--routers/user/auth.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/routers/user/auth.go b/routers/user/auth.go
index 40687fca..031ac026 100644
--- a/routers/user/auth.go
+++ b/routers/user/auth.go
@@ -76,8 +76,15 @@ func SignIn(ctx *context.Context) {
return
}
+ redirectTo := ctx.Query("redirect_to")
+ if len(redirectTo) > 0 {
+ ctx.SetCookie("redirect_to", redirectTo, 0, setting.AppSubUrl)
+ } else {
+ redirectTo, _ = url.QueryUnescape(ctx.GetCookie("redirect_to"))
+ }
+
if isSucceed {
- if redirectTo, _ := url.QueryUnescape(ctx.GetCookie("redirect_to")); len(redirectTo) > 0 {
+ if len(redirectTo) > 0 {
ctx.SetCookie("redirect_to", "", -1, setting.AppSubUrl)
ctx.Redirect(redirectTo)
} else {