Increase session cookies expiration
This commit is contained in:
parent
948e12c861
commit
e4b4beabf0
1 changed files with 5 additions and 1 deletions
|
@ -13,9 +13,12 @@ import (
|
||||||
const (
|
const (
|
||||||
CookieSessionID = "sessionID"
|
CookieSessionID = "sessionID"
|
||||||
CookieUserSessionID = "userSessionID"
|
CookieUserSessionID = "userSessionID"
|
||||||
|
|
||||||
|
// Cookie duration in days.
|
||||||
|
cookieDuration = 30
|
||||||
)
|
)
|
||||||
|
|
||||||
// New create a new cookie.
|
// New creates a new cookie.
|
||||||
func New(name, value string, isHTTPS bool) *http.Cookie {
|
func New(name, value string, isHTTPS bool) *http.Cookie {
|
||||||
return &http.Cookie{
|
return &http.Cookie{
|
||||||
Name: name,
|
Name: name,
|
||||||
|
@ -23,6 +26,7 @@ func New(name, value string, isHTTPS bool) *http.Cookie {
|
||||||
Path: "/",
|
Path: "/",
|
||||||
Secure: isHTTPS,
|
Secure: isHTTPS,
|
||||||
HttpOnly: true,
|
HttpOnly: true,
|
||||||
|
Expires: time.Now().Add(cookieDuration * 24 * time.Hour),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue