(cherry picked from commit 39096208ed)
Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
This commit is contained in:
co-authored by
Emil Tullstedt
parent
4371c45dff
commit
a4431a7cbf
+5
-16
@@ -1246,27 +1246,16 @@ func readAuthSettings(iniFile *ini.File, cfg *Cfg) (err error) {
|
||||
auth := iniFile.Section("auth")
|
||||
|
||||
cfg.LoginCookieName = valueAsString(auth, "login_cookie_name", "grafana_session")
|
||||
maxInactiveDaysVal := auth.Key("login_maximum_inactive_lifetime_days").MustString("")
|
||||
if maxInactiveDaysVal != "" {
|
||||
maxInactiveDaysVal = fmt.Sprintf("%sd", maxInactiveDaysVal)
|
||||
cfg.Logger.Warn("[Deprecated] the configuration setting 'login_maximum_inactive_lifetime_days' is deprecated, please use 'login_maximum_inactive_lifetime_duration' instead")
|
||||
} else {
|
||||
maxInactiveDaysVal = "7d"
|
||||
}
|
||||
maxInactiveDurationVal := valueAsString(auth, "login_maximum_inactive_lifetime_duration", maxInactiveDaysVal)
|
||||
|
||||
const defaultMaxInactiveLifetime = "7d"
|
||||
maxInactiveDurationVal := valueAsString(auth, "login_maximum_inactive_lifetime_duration", defaultMaxInactiveLifetime)
|
||||
cfg.LoginMaxInactiveLifetime, err = gtime.ParseDuration(maxInactiveDurationVal)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
maxLifetimeDaysVal := auth.Key("login_maximum_lifetime_days").MustString("")
|
||||
if maxLifetimeDaysVal != "" {
|
||||
maxLifetimeDaysVal = fmt.Sprintf("%sd", maxLifetimeDaysVal)
|
||||
cfg.Logger.Warn("[Deprecated] the configuration setting 'login_maximum_lifetime_days' is deprecated, please use 'login_maximum_lifetime_duration' instead")
|
||||
} else {
|
||||
maxLifetimeDaysVal = "30d"
|
||||
}
|
||||
maxLifetimeDurationVal := valueAsString(auth, "login_maximum_lifetime_duration", maxLifetimeDaysVal)
|
||||
const defaultMaxLifetime = "30d"
|
||||
maxLifetimeDurationVal := valueAsString(auth, "login_maximum_lifetime_duration", defaultMaxLifetime)
|
||||
cfg.LoginMaxLifetime, err = gtime.ParseDuration(maxLifetimeDurationVal)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user