From c1e1506720e3c8b4e8782da9ff73ce1c57ce71a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Guillot?= Date: Sun, 9 Sep 2018 14:25:56 -0700 Subject: [PATCH] Revert cookie flag from strict to lax mode otherwise oauth2 won't work --- http/cookie/cookie.go | 4 ++-- model/app_session.go | 4 ++-- template/engine.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/http/cookie/cookie.go b/http/cookie/cookie.go index 9ac79a1e..799d26ce 100644 --- a/http/cookie/cookie.go +++ b/http/cookie/cookie.go @@ -27,7 +27,7 @@ func New(name, value string, isHTTPS bool, path string) *http.Cookie { Secure: isHTTPS, HttpOnly: true, Expires: time.Now().Add(cookieDuration * 24 * time.Hour), - SameSite: http.SameSiteStrictMode, + SameSite: http.SameSiteLaxMode, } } @@ -41,7 +41,7 @@ func Expired(name string, isHTTPS bool, path string) *http.Cookie { HttpOnly: true, MaxAge: -1, Expires: time.Date(1970, 1, 1, 0, 0, 0, 0, time.UTC), - SameSite: http.SameSiteStrictMode, + SameSite: http.SameSiteLaxMode, } } diff --git a/model/app_session.go b/model/app_session.go index 4f97c4c1..6a1f6ff7 100644 --- a/model/app_session.go +++ b/model/app_session.go @@ -23,8 +23,8 @@ type SessionData struct { } func (s SessionData) String() string { - return fmt.Sprintf(`CSRF=%q, "OAuth2State=%q, FlashMsg=%q, FlashErrorMsg=%q, Lang=%q, Theme=%q`, - s.CSRF, s.OAuth2State, s.FlashMessage, s.FlashErrorMessage, s.Language, s.Theme) + return fmt.Sprintf(`CSRF=%q, OAuth2State=%q, FlashMsg=%q, FlashErrMsg=%q, Lang=%q, Theme=%q, PocketTkn=%q`, + s.CSRF, s.OAuth2State, s.FlashMessage, s.FlashErrorMessage, s.Language, s.Theme, s.PocketRequestToken) } // Value converts the session data to JSON. diff --git a/template/engine.go b/template/engine.go index 5a46e0ce..629059a5 100644 --- a/template/engine.go +++ b/template/engine.go @@ -36,7 +36,7 @@ func (e *Engine) parseAll() { } } -// Render process a template and write the ouput. +// Render process a template. func (e *Engine) Render(name, language string, data interface{}) []byte { tpl, ok := e.templates[name] if !ok {