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 (
|
||||
CookieSessionID = "sessionID"
|
||||
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 {
|
||||
return &http.Cookie{
|
||||
Name: name,
|
||||
|
@ -23,6 +26,7 @@ func New(name, value string, isHTTPS bool) *http.Cookie {
|
|||
Path: "/",
|
||||
Secure: isHTTPS,
|
||||
HttpOnly: true,
|
||||
Expires: time.Now().Add(cookieDuration * 24 * time.Hour),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue