MM-41211: Adds ability to set SessionLengthSSOInDays to a decimal. (#19396)
* MM-41211: Accepts a decimal for the SSO session length. * MM-41211: Fixes test and logic error. * MM-41211: Validates session length is minimum 1 hour. * MM-41211: Tricking the CI to allow an empty string. * Fixes a test error and some lint changes. * Fix error. * Reverting IDE change. Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
@@ -199,14 +199,14 @@ func (us *UserService) RevokeAccessToken(token string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetSessionExpireInDays sets the session's expiry the specified number of days
|
||||
// SetSessionExpireInHours sets the session's expiry the specified number of days
|
||||
// relative to either the session creation date or the current time, depending
|
||||
// on the `ExtendSessionOnActivity` config setting.
|
||||
func (us *UserService) SetSessionExpireInDays(session *model.Session, days int) {
|
||||
func (us *UserService) SetSessionExpireInHours(session *model.Session, hours int) {
|
||||
if session.CreateAt == 0 || *us.config().ServiceSettings.ExtendSessionLengthWithActivity {
|
||||
session.ExpiresAt = model.GetMillis() + (1000 * 60 * 60 * 24 * int64(days))
|
||||
session.ExpiresAt = model.GetMillis() + (1000 * 60 * 60 * int64(hours))
|
||||
} else {
|
||||
session.ExpiresAt = session.CreateAt + (1000 * 60 * 60 * 24 * int64(days))
|
||||
session.ExpiresAt = session.CreateAt + (1000 * 60 * 60 * int64(hours))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user