summaryrefslogtreecommitdiffstats
path: root/routers/user/oauth.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2020-05-17 13:43:29 +0100
committerGitHub <noreply@github.com>2020-05-17 15:43:29 +0300
commit76053ac31afccefc0335977a131089e696b46eab (patch)
tree19dfbe34ecf450c7e33e45355e098ca87d8f24cb /routers/user/oauth.go
parent50932ce8afb7e3bbae7be9ed854ba13c8002139a (diff)
downloadgitea-76053ac31afccefc0335977a131089e696b46eab.tar.gz
gitea-76053ac31afccefc0335977a131089e696b46eab.zip
Whenever the ctx.Session is updated, release it to save it before sending the redirect (#11456)
Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'routers/user/oauth.go')
-rw-r--r--routers/user/oauth.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/routers/user/oauth.go b/routers/user/oauth.go
index d4dcb857fa..a9e089b39f 100644
--- a/routers/user/oauth.go
+++ b/routers/user/oauth.go
@@ -229,6 +229,11 @@ func AuthorizeOAuth(ctx *context.Context, form auth.AuthorizationForm) {
}, form.RedirectURI)
return
}
+ // Here we're just going to try to release the session early
+ if err := ctx.Session.Release(); err != nil {
+ // we'll tolerate errors here as they *should* get saved elsewhere
+ log.Error("Unable to save changes to the session: %v", err)
+ }
case "":
break
default:
@@ -287,6 +292,11 @@ func AuthorizeOAuth(ctx *context.Context, form auth.AuthorizationForm) {
log.Error(err.Error())
return
}
+ // Here we're just going to try to release the session early
+ if err := ctx.Session.Release(); err != nil {
+ // we'll tolerate errors here as they *should* get saved elsewhere
+ log.Error("Unable to save changes to the session: %v", err)
+ }
ctx.HTML(200, tplGrantAccess)
}