summaryrefslogtreecommitdiffstats
path: root/routers/web/auth/oauth.go
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2023-04-14 03:45:33 +0800
committerGitHub <noreply@github.com>2023-04-13 15:45:33 -0400
commit5b9557aef59b190c55de9ea218bf51152bc04786 (patch)
treed77004c983875886a00acd1561a74b8c3d5ce682 /routers/web/auth/oauth.go
parentb7221bec34fd49495234a18c26e4f5d81483e102 (diff)
downloadgitea-5b9557aef59b190c55de9ea218bf51152bc04786.tar.gz
gitea-5b9557aef59b190c55de9ea218bf51152bc04786.zip
Refactor cookie (#24107)
Close #24062 At the beginning, I just wanted to fix the warning mentioned by #24062 But, the cookie code really doesn't look good to me, so clean up them. Complete the TODO on `SetCookie`: > TODO: Copied from gitea.com/macaron/macaron and should be improved after macaron removed.
Diffstat (limited to 'routers/web/auth/oauth.go')
-rw-r--r--routers/web/auth/oauth.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/routers/web/auth/oauth.go b/routers/web/auth/oauth.go
index b3c4a234c1..287136e64c 100644
--- a/routers/web/auth/oauth.go
+++ b/routers/web/auth/oauth.go
@@ -1112,7 +1112,7 @@ func handleOAuth2SignIn(ctx *context.Context, source *auth.Source, u *user_model
}
// Clear whatever CSRF cookie has right now, force to generate a new one
- middleware.DeleteCSRFCookie(ctx.Resp)
+ ctx.Csrf.DeleteCookie(ctx)
// Register last login
u.SetLastLogin()
@@ -1148,7 +1148,7 @@ func handleOAuth2SignIn(ctx *context.Context, source *auth.Source, u *user_model
return
}
- if redirectTo := ctx.GetCookie("redirect_to"); len(redirectTo) > 0 {
+ if redirectTo := ctx.GetSiteCookie("redirect_to"); len(redirectTo) > 0 {
middleware.DeleteRedirectToCookie(ctx.Resp)
ctx.RedirectToFirst(redirectTo)
return