mirror of
https://github.com/miniflux/v2.git
synced 2025-08-11 17:51:01 +00:00
Revert "feat(cookie): use SameSiteStrictMode
when not using OAuth2/OIDC"
This reverts commit 135ce1d546
.
People using Miniflux as PWA on Android are constantly being logged out.
This commit is contained in:
parent
0f3c04a98a
commit
d3ad460c9d
1 changed files with 4 additions and 16 deletions
|
@ -18,26 +18,20 @@ const (
|
||||||
|
|
||||||
// New creates a new cookie.
|
// New creates a new cookie.
|
||||||
func New(name, value string, isHTTPS bool, path string) *http.Cookie {
|
func New(name, value string, isHTTPS bool, path string) *http.Cookie {
|
||||||
cookie := &http.Cookie{
|
return &http.Cookie{
|
||||||
Name: name,
|
Name: name,
|
||||||
Value: value,
|
Value: value,
|
||||||
Path: basePath(path),
|
Path: basePath(path),
|
||||||
Secure: isHTTPS,
|
Secure: isHTTPS,
|
||||||
HttpOnly: true,
|
HttpOnly: true,
|
||||||
Expires: time.Now().Add(time.Duration(config.Opts.CleanupRemoveSessionsDays()) * 24 * time.Hour),
|
Expires: time.Now().Add(time.Duration(config.Opts.CleanupRemoveSessionsDays()) * 24 * time.Hour),
|
||||||
SameSite: http.SameSiteStrictMode,
|
SameSite: http.SameSiteLaxMode,
|
||||||
}
|
}
|
||||||
|
|
||||||
// OAuth doesn't work when cookies are in strict mode.
|
|
||||||
if config.Opts.OAuth2Provider() != "" {
|
|
||||||
cookie.SameSite = http.SameSiteLaxMode
|
|
||||||
}
|
|
||||||
return cookie
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Expired returns an expired cookie.
|
// Expired returns an expired cookie.
|
||||||
func Expired(name string, isHTTPS bool, path string) *http.Cookie {
|
func Expired(name string, isHTTPS bool, path string) *http.Cookie {
|
||||||
cookie := &http.Cookie{
|
return &http.Cookie{
|
||||||
Name: name,
|
Name: name,
|
||||||
Value: "",
|
Value: "",
|
||||||
Path: basePath(path),
|
Path: basePath(path),
|
||||||
|
@ -45,14 +39,8 @@ func Expired(name string, isHTTPS bool, path string) *http.Cookie {
|
||||||
HttpOnly: true,
|
HttpOnly: true,
|
||||||
MaxAge: -1,
|
MaxAge: -1,
|
||||||
Expires: time.Date(1970, 1, 1, 0, 0, 0, 0, time.UTC),
|
Expires: time.Date(1970, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||||
SameSite: http.SameSiteStrictMode,
|
SameSite: http.SameSiteLaxMode,
|
||||||
}
|
}
|
||||||
|
|
||||||
// OAuth doesn't work when cookies are in strict mode.
|
|
||||||
if config.Opts.OAuth2Provider() != "" {
|
|
||||||
cookie.SameSite = http.SameSiteLaxMode
|
|
||||||
}
|
|
||||||
return cookie
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func basePath(path string) string {
|
func basePath(path string) string {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue