mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-18 17:00:02 +02:00
Support setting cookie domain (#6288)
Signed-off-by: Tamal Saha <tamal@appscode.com>
This commit is contained in:
parent
d95237b561
commit
2102f9d92d
15 changed files with 58 additions and 46 deletions
6
vendor/github.com/go-macaron/i18n/i18n.go
generated
vendored
6
vendor/github.com/go-macaron/i18n/i18n.go
generated
vendored
|
@ -26,7 +26,7 @@ import (
|
|||
"gopkg.in/macaron.v1"
|
||||
)
|
||||
|
||||
const _VERSION = "0.3.0"
|
||||
const _VERSION = "0.4.0"
|
||||
|
||||
func Version() string {
|
||||
return _VERSION
|
||||
|
@ -96,6 +96,8 @@ type Options struct {
|
|||
TmplName string
|
||||
// Configuration section name. Default is "i18n".
|
||||
Section string
|
||||
// Domain used for `lang` cookie. Default is ""
|
||||
CookieDomain string
|
||||
}
|
||||
|
||||
func prepareOptions(options []Options) Options {
|
||||
|
@ -193,7 +195,7 @@ func I18n(options ...Options) macaron.Handler {
|
|||
|
||||
// Save language information in cookies.
|
||||
if !hasCookie {
|
||||
ctx.SetCookie("lang", curLang.Lang, 1<<31-1, "/"+strings.TrimPrefix(opt.SubURL, "/"))
|
||||
ctx.SetCookie("lang", curLang.Lang, 1<<31-1, "/"+strings.TrimPrefix(opt.SubURL, "/"), opt.CookieDomain)
|
||||
}
|
||||
|
||||
restLangs := make([]LangType, 0, i18n.Count()-1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue