MM-23935 extend session expiry on user activity (#14275)

* MM-23935  extend session expiry on user activity

- if user types anything before a session expires the session will be extended to now + session length

- ensures new session expiries are not written to DB too frequently

- new session store func for updating session ExpiresAt

- session length defaults for mobile and web/ldap changed from 180 days to 30 days
Этот коммит содержится в:
Doug Lauder
2020-05-06 15:41:10 -04:00
коммит произвёл GitHub
родитель 58305b080f
Коммит 5e59b5f70c
18 изменённых файлов: 349 добавлений и 5 удалений

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

@@ -283,6 +283,7 @@ type ServiceSettings struct {
CorsAllowCredentials *bool `restricted:"true"`
CorsDebug *bool `restricted:"true"`
AllowCookiesForSubdomains *bool `restricted:"true"`
ExtendSessionLengthWithActivity *bool `restricted:"true"`
SessionLengthWebInDays *int `restricted:"true"`
SessionLengthMobileInDays *int `restricted:"true"`
SessionLengthSSOInDays *int `restricted:"true"`
@@ -521,12 +522,25 @@ func (s *ServiceSettings) SetDefaults(isUpdate bool) {
s.EnableTutorial = NewBool(true)
}
// Must be manually enabled for existing installations.
if s.ExtendSessionLengthWithActivity == nil {
s.ExtendSessionLengthWithActivity = NewBool(!isUpdate)
}
if s.SessionLengthWebInDays == nil {
s.SessionLengthWebInDays = NewInt(180)
if isUpdate {
s.SessionLengthWebInDays = NewInt(180)
} else {
s.SessionLengthWebInDays = NewInt(30)
}
}
if s.SessionLengthMobileInDays == nil {
s.SessionLengthMobileInDays = NewInt(180)
if isUpdate {
s.SessionLengthMobileInDays = NewInt(180)
} else {
s.SessionLengthMobileInDays = NewInt(30)
}
}
if s.SessionLengthSSOInDays == nil {