This commit is contained in:
Yvan
2026-09-04 16:51:03 +08:00
parent dce95412dd
commit d83720c8fd
3 changed files with 83 additions and 2 deletions
+2 -2
View File
@@ -43,7 +43,7 @@ type SecurityConfigPO struct {
func (SecurityConfigPO) TableName() string { return "sys_security_config" }
func DefaultSecurityConfig() SecurityConfigPO {
return SecurityConfigPO{ID: 1, CaptchaTimeout: 3600, KeyLong: 6, ImgWidth: 240, ImgHeight: 80, PwdMinLength: 8, LimitWindow: 60, LimitCount: 30, LockThreshold: 5, LockDuration: 30, PwdExpireDays: 90}
return securityToPO(system.DefaultSecurityConfig())
}
type securityRepo struct{ data DatabaseProvider }
@@ -60,7 +60,7 @@ func securityToPO(v *system.SecurityConfig) SecurityConfigPO {
func (r *securityRepo) SecurityConfig(ctx context.Context) (*system.SecurityConfig, error) {
if !r.data.DatabaseReady() {
return nil, errors.New("数据库未初始化")
return nil, system.ErrDatabaseNotInitialized
}
db := r.data.DB().WithContext(ctx)
var po SecurityConfigPO