Add secure/httpOnly attributes to the lang cookie (#14279) (#14280)

* Add secure/httpOnly attributes to the lang cookie (#9690) (#14279)

* apply to InitLocales() too

Co-authored-by: Timo Gurr <timo.gurr@gmail.com>
This commit is contained in:
6543 2021-01-07 15:35:02 +01:00 committed by GitHub
parent 4be59eb5d9
commit fb656b5124
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 14 deletions

View file

@ -110,13 +110,15 @@ func InitLocales() {
} }
} }
i18n.I18n(i18n.Options{ i18n.I18n(i18n.Options{
SubURL: setting.AppSubURL, SubURL: setting.AppSubURL,
Files: localFiles, Files: localFiles,
Langs: setting.Langs, Langs: setting.Langs,
Names: setting.Names, Names: setting.Names,
DefaultLang: "en-US", DefaultLang: "en-US",
Redirect: false, Redirect: false,
CookieDomain: setting.SessionConfig.Domain, CookieHttpOnly: true,
Secure: setting.SessionConfig.Secure,
CookieDomain: setting.SessionConfig.Domain,
}) })
} }

View file

@ -247,13 +247,15 @@ func NewMacaron() *macaron.Macaron {
} }
m.Use(i18n.I18n(i18n.Options{ m.Use(i18n.I18n(i18n.Options{
SubURL: setting.AppSubURL, SubURL: setting.AppSubURL,
Files: localFiles, Files: localFiles,
Langs: setting.Langs, Langs: setting.Langs,
Names: setting.Names, Names: setting.Names,
DefaultLang: "en-US", DefaultLang: "en-US",
Redirect: false, Redirect: false,
CookieDomain: setting.SessionConfig.Domain, CookieHttpOnly: true,
Secure: setting.SessionConfig.Secure,
CookieDomain: setting.SessionConfig.Domain,
})) }))
m.Use(cache.Cacher(cache.Options{ m.Use(cache.Cacher(cache.Options{
Adapter: setting.CacheService.Adapter, Adapter: setting.CacheService.Adapter,