优化
This commit is contained in:
@@ -21,14 +21,14 @@ import (
|
||||
type Public struct {
|
||||
auth *service.AuthService
|
||||
system *service.SystemConfigService
|
||||
settings *service.SettingsService
|
||||
settings *service.SecurityService
|
||||
audit *service.AuditService
|
||||
scheduler *worker.TaskScheduler
|
||||
runtime *conf.Runtime
|
||||
store *captchaStore
|
||||
}
|
||||
|
||||
func NewPublic(runtime *conf.Runtime, auth *service.AuthService, system *service.SystemConfigService, settings *service.SettingsService, audit *service.AuditService, scheduler *worker.TaskScheduler) *Public {
|
||||
func NewPublic(runtime *conf.Runtime, auth *service.AuthService, system *service.SystemConfigService, settings *service.SecurityService, audit *service.AuditService, scheduler *worker.TaskScheduler) *Public {
|
||||
return &Public{auth: auth, system: system, settings: settings, audit: audit, scheduler: scheduler, runtime: runtime, store: &captchaStore{service: settings, runtime: runtime}}
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ func (h *Public) Login(c *gin.Context) {
|
||||
httpx.Write(c, httpx.CodeSuccess, result, "登录成功")
|
||||
}
|
||||
|
||||
func ensureLoginIPCounter(ctx context.Context, settings *service.SettingsService, ip string, expiration time.Duration) (int, error) {
|
||||
func ensureLoginIPCounter(ctx context.Context, settings *service.SecurityService, ip string, expiration time.Duration) (int, error) {
|
||||
value, exists, err := settings.CacheGet(ctx, ip)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
@@ -195,7 +195,7 @@ func (h *Public) InitializeDatabase(engine *gin.Engine) gin.HandlerFunc {
|
||||
}
|
||||
|
||||
type captchaStore struct {
|
||||
service *service.SettingsService
|
||||
service *service.SecurityService
|
||||
runtime *conf.Runtime
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user