diff options
author | zeripath <art27@cantab.net> | 2021-03-07 08:12:43 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-07 08:12:43 +0000 |
commit | 9b261f52f074fcc11fd705dae63084364c4f7adf (patch) | |
tree | 587521b6929105a76b288a962316504380c1c494 /routers/user/setting/profile.go | |
parent | beed5476e2831f7a0943d484873f4f49dfdd256f (diff) | |
download | gitea-9b261f52f074fcc11fd705dae63084364c4f7adf.tar.gz gitea-9b261f52f074fcc11fd705dae63084364c4f7adf.zip |
Add SameSite setting for cookies (#14900)
Add SameSite setting for cookies and rationalise the cookie setting code. Switches SameSite to Lax by default.
There is a possible future extension of differentiating which cookies could be set at Strict by default but that is for a future PR.
Fix #5583
Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'routers/user/setting/profile.go')
-rw-r--r-- | routers/user/setting/profile.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/routers/user/setting/profile.go b/routers/user/setting/profile.go index 7e90a7ccec..38e371196a 100644 --- a/routers/user/setting/profile.go +++ b/routers/user/setting/profile.go @@ -21,6 +21,7 @@ import ( "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/util" "code.gitea.io/gitea/modules/web" + "code.gitea.io/gitea/modules/web/middleware" "github.com/unknwon/i18n" ) @@ -116,7 +117,7 @@ func ProfilePost(ctx *context.Context) { } // Update the language to the one we just set - ctx.SetCookie("lang", ctx.User.Language, nil, setting.AppSubURL, setting.SessionConfig.Domain, setting.SessionConfig.Secure, true) + middleware.SetLocaleCookie(ctx.Resp, ctx.User.Language, 0) log.Trace("User settings updated: %s", ctx.User.Name) ctx.Flash.Success(i18n.Tr(ctx.User.Language, "settings.update_profile_success")) |