1
1
mirror of https://github.com/go-gitea/gitea synced 2025-08-14 05:28:27 +00:00

Reset locale on login (#17734) (#18100)

Backport #17734

When logging in reset the user's locale to ensure that it matches their
preferred locale.

Fix #15612

Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
zeripath
2021-12-25 13:31:23 +00:00
committed by GitHub
parent 6eaebda1b5
commit d25ff0d695
3 changed files with 10 additions and 0 deletions

View File

@@ -584,6 +584,10 @@ func handleSignInFull(ctx *context.Context, u *models.User, remember bool, obeyR
middleware.SetLocaleCookie(ctx.Resp, u.Language, 0)
if ctx.Locale.Language() != u.Language {
ctx.Locale = middleware.Locale(ctx.Resp, ctx.Req)
}
// Clear whatever CSRF has right now, force to generate a new one
middleware.DeleteCSRFCookie(ctx.Resp)