MM-41211: Replaces SessionLength*InDays with SessionLength*InHours. (#19838)

* MM-41211: Replaces SessionLength[Web|Mobile|SSO]InDays with SessionLength[Web|Mobile|SSO]InHours.

* MM-41211: Clear the value of the old config settings.
Этот коммит содержится в:
Martin Kraft
2022-04-28 17:31:35 -04:00
коммит произвёл GitHub
родитель 4bc2ed3973
Коммит cb3d8f0a1c
19 изменённых файлов: 198 добавлений и 168 удалений

Просмотреть файл

@@ -2085,9 +2085,9 @@ func attachDeviceId(c *Context, w http.ResponseWriter, r *http.Request) {
}
c.App.ClearSessionCacheForUser(c.AppContext.Session().UserId)
c.App.SetSessionExpireInDays(c.AppContext.Session(), *c.App.Config().ServiceSettings.SessionLengthMobileInDays)
c.App.SetSessionExpireInHours(c.AppContext.Session(), *c.App.Config().ServiceSettings.SessionLengthMobileInHours)
maxAge := *c.App.Config().ServiceSettings.SessionLengthMobileInDays * 60 * 60 * 24
maxAgeSeconds := *c.App.Config().ServiceSettings.SessionLengthMobileInHours * 60 * 60
secure := false
if app.GetProtocol(r) == "https" {
@@ -2096,12 +2096,12 @@ func attachDeviceId(c *Context, w http.ResponseWriter, r *http.Request) {
subpath, _ := utils.GetSubpathFromConfig(c.App.Config())
expiresAt := time.Unix(model.GetMillis()/1000+int64(maxAge), 0)
expiresAt := time.Unix(model.GetMillis()/1000+int64(maxAgeSeconds), 0)
sessionCookie := &http.Cookie{
Name: model.SessionCookieToken,
Value: c.AppContext.Session().Token,
Path: subpath,
MaxAge: maxAge,
MaxAge: maxAgeSeconds,
Expires: expiresAt,
HttpOnly: true,
Domain: c.App.GetCookieDomain(),