mirror of
				https://github.com/TeaOSLab/EdgeCommon.git
				synced 2025-11-04 21:50:26 +08:00 
			
		
		
		
	安全设置中增加允许记住登录选项
This commit is contained in:
		@@ -2,18 +2,19 @@ package systemconfigs
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
 | 
					import "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 安全相关配置
 | 
					// SecurityConfig 安全相关配置
 | 
				
			||||||
type SecurityConfig struct {
 | 
					type SecurityConfig struct {
 | 
				
			||||||
	Frame            string   `json:"frame"`            // Frame嵌套
 | 
						Frame              string   `json:"frame"`              // Frame嵌套
 | 
				
			||||||
	AllowCountryIds  []int64  `json:"allowCountryIds"`  // 允许的国家/地区
 | 
						AllowCountryIds    []int64  `json:"allowCountryIds"`    // 允许的国家/地区
 | 
				
			||||||
	AllowProvinceIds []int64  `json:"allowProvinceIds"` // 允许的省份
 | 
						AllowProvinceIds   []int64  `json:"allowProvinceIds"`   // 允许的省份
 | 
				
			||||||
	AllowLocal       bool     `json:"allowLocal"`       // 允许本地+局域网IP访问
 | 
						AllowLocal         bool     `json:"allowLocal"`         // 允许本地+局域网IP访问
 | 
				
			||||||
	AllowIPs         []string `json:"allowIPs"`         // 允许访问的IP
 | 
						AllowIPs           []string `json:"allowIPs"`           // 允许访问的IP
 | 
				
			||||||
 | 
						AllowRememberLogin bool     `json:"allowRememberLogin"` // 是否允许在设备上记住登录
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	allowIPRanges []*shared.IPRangeConfig
 | 
						allowIPRanges []*shared.IPRangeConfig
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 初始化
 | 
					// Init 初始化
 | 
				
			||||||
func (this *SecurityConfig) Init() error {
 | 
					func (this *SecurityConfig) Init() error {
 | 
				
			||||||
	this.allowIPRanges = []*shared.IPRangeConfig{}
 | 
						this.allowIPRanges = []*shared.IPRangeConfig{}
 | 
				
			||||||
	for _, allowIP := range this.AllowIPs {
 | 
						for _, allowIP := range this.AllowIPs {
 | 
				
			||||||
@@ -26,6 +27,7 @@ func (this *SecurityConfig) Init() error {
 | 
				
			|||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// AllowIPRanges 查询允许的IP区域
 | 
				
			||||||
func (this *SecurityConfig) AllowIPRanges() []*shared.IPRangeConfig {
 | 
					func (this *SecurityConfig) AllowIPRanges() []*shared.IPRangeConfig {
 | 
				
			||||||
	return this.allowIPRanges
 | 
						return this.allowIPRanges
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user