安全设置中增加允许记住登录选项

This commit is contained in:
刘祥超
2021-08-11 09:36:16 +08:00
parent 10e2a08cd2
commit a39eb80214
4 changed files with 31 additions and 13 deletions

View File

@@ -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()
}

View File

@@ -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)