@@ -93,12 +93,8 @@ func checkAutoLogin(ctx *context.Context) bool {
9393 }
9494
9595 if isSucceed {
96- if len (redirectTo ) > 0 {
97- ctx .SetCookie ("redirect_to" , "" , - 1 , setting .AppSubURL )
98- ctx .Redirect (redirectTo )
99- } else {
100- ctx .Redirect (setting .AppSubURL + string (setting .LandingPageURL ))
101- }
96+ ctx .SetCookie ("redirect_to" , "" , - 1 , setting .AppSubURL )
97+ ctx .RedirectToFirst (redirectTo , setting .AppSubURL + string (setting .LandingPageURL ))
10298 return true
10399 }
104100
@@ -350,7 +346,7 @@ func handleSignInFull(ctx *context.Context, u *models.User, remember bool, obeyR
350346 if redirectTo , _ := url .QueryUnescape (ctx .GetCookie ("redirect_to" )); len (redirectTo ) > 0 {
351347 ctx .SetCookie ("redirect_to" , "" , - 1 , setting .AppSubURL )
352348 if obeyRedirect {
353- ctx .Redirect (redirectTo )
349+ ctx .RedirectToFirst (redirectTo )
354350 }
355351 return
356352 }
@@ -439,7 +435,7 @@ func handleOAuth2SignIn(u *models.User, gothUser goth.User, ctx *context.Context
439435
440436 if redirectTo , _ := url .QueryUnescape (ctx .GetCookie ("redirect_to" )); len (redirectTo ) > 0 {
441437 ctx .SetCookie ("redirect_to" , "" , - 1 , setting .AppSubURL )
442- ctx .Redirect (redirectTo )
438+ ctx .RedirectToFirst (redirectTo )
443439 return
444440 }
445441
0 commit comments