mirror of
https://github.com/abhinavxd/libredesk.git
synced 2025-11-03 05:23:48 +00:00
fix: max age not working for cookies
Switch from expires to max age for setting cookie expiry Set default max age to 9 hours
This commit is contained in:
@@ -90,9 +90,10 @@ func New(cfg Config, rd *redis.Client, logger *logf.Logger) (*Auth, error) {
|
||||
EnableAutoCreate: true,
|
||||
SessionIDLength: 64,
|
||||
Cookie: simplesessions.CookieOptions{
|
||||
Name: "libredesk_session",
|
||||
IsHTTPOnly: true,
|
||||
IsSecure: true,
|
||||
Expires: time.Now().Add(time.Hour * 48),
|
||||
MaxAge: time.Hour * 9,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -388,6 +389,7 @@ func simpleSessGetCookieCB(name string, r interface{}) (*http.Cookie, error) {
|
||||
Path: string(c.Path()),
|
||||
Domain: string(c.Domain()),
|
||||
Expires: c.Expire(),
|
||||
MaxAge: c.MaxAge(),
|
||||
Secure: c.Secure(),
|
||||
HttpOnly: c.HTTPOnly(),
|
||||
SameSite: http.SameSite(c.SameSite()),
|
||||
@@ -410,6 +412,7 @@ func simpleSessSetCookieCB(c *http.Cookie, w interface{}) error {
|
||||
fc.SetPath(c.Path)
|
||||
fc.SetDomain(c.Domain)
|
||||
fc.SetExpire(c.Expires)
|
||||
fc.SetMaxAge(int(c.MaxAge))
|
||||
fc.SetSecure(c.Secure)
|
||||
fc.SetHTTPOnly(c.HttpOnly)
|
||||
fc.SetSameSite(fasthttp.CookieSameSite(c.SameSite))
|
||||
|
||||
Reference in New Issue
Block a user