diff --git a/internal/web/actions/default/index/index.go b/internal/web/actions/default/index/index.go index 909e22ba..e36ca17d 100644 --- a/internal/web/actions/default/index/index.go +++ b/internal/web/actions/default/index/index.go @@ -56,19 +56,26 @@ func (this *IndexAction) RunGet(params struct { this.Data["token"] = stringutil.Md5(TokenSalt+timestamp) + timestamp this.Data["from"] = params.From - config, err := configloaders.LoadAdminUIConfig() + uiConfig, err := configloaders.LoadAdminUIConfig() if err != nil { this.ErrorPage(err) return } - this.Data["systemName"] = config.AdminSystemName - this.Data["showVersion"] = config.ShowVersion - if len(config.Version) > 0 { - this.Data["version"] = config.Version + this.Data["systemName"] = uiConfig.AdminSystemName + this.Data["showVersion"] = uiConfig.ShowVersion + if len(uiConfig.Version) > 0 { + this.Data["version"] = uiConfig.Version } else { this.Data["version"] = teaconst.Version } - this.Data["faviconFileId"] = config.FaviconFileId + this.Data["faviconFileId"] = uiConfig.FaviconFileId + + securityConfig, err := configloaders.LoadSecurityConfig() + if err != nil { + this.Data["rememberLogin"] = false + } else { + this.Data["rememberLogin"] = securityConfig.AllowRememberLogin + } this.Show() } diff --git a/internal/web/actions/default/settings/security/index.go b/internal/web/actions/default/settings/security/index.go index 20cec226..d972d7ac 100644 --- a/internal/web/actions/default/settings/security/index.go +++ b/internal/web/actions/default/settings/security/index.go @@ -69,11 +69,12 @@ func (this *IndexAction) RunGet(params struct{}) { } func (this *IndexAction) RunPost(params struct { - Frame string - CountryIdsJSON []byte - ProvinceIdsJSON []byte - AllowLocal bool - AllowIPs []string + Frame string + CountryIdsJSON []byte + ProvinceIdsJSON []byte + AllowLocal bool + AllowIPs []string + AllowRememberLogin bool Must *actions.Must CSRF *actionutils.CSRF @@ -127,6 +128,9 @@ func (this *IndexAction) RunPost(params struct { // 允许本地 config.AllowLocal = params.AllowLocal + // 允许记住登录 + config.AllowRememberLogin = params.AllowRememberLogin + err = configloaders.UpdateSecurityConfig(config) if err != nil { this.ErrorPage(err) diff --git a/web/views/@default/index/index.html b/web/views/@default/index/index.html index 77dc5885..e73d8f66 100644 --- a/web/views/@default/index/index.html +++ b/web/views/@default/index/index.html @@ -47,10 +47,10 @@ -
选中表示允许在本机和局域网访问。
+选中表示允许在登录界面可以选择记住登录。
+