优化
This commit is contained in:
@@ -33,11 +33,17 @@ type SecurityRepo interface {
|
||||
SaveSecurityConfig(context.Context, *SecurityConfig) error
|
||||
}
|
||||
|
||||
func (uc *SettingsUsecase) UpdateSecurity(ctx context.Context, value *SecurityConfig) error {
|
||||
type SecurityUsecase struct{ SecurityRepo }
|
||||
|
||||
func NewSecurityUsecase(repo SecurityRepo) *SecurityUsecase {
|
||||
return &SecurityUsecase{SecurityRepo: repo}
|
||||
}
|
||||
|
||||
func (uc *SecurityUsecase) UpdateSecurity(ctx context.Context, value *SecurityConfig) error {
|
||||
return uc.SaveSecurityConfig(ctx, value)
|
||||
}
|
||||
|
||||
func (uc *SettingsUsecase) ValidatePassword(value *SecurityConfig, password string) error {
|
||||
func (uc *SecurityUsecase) ValidatePassword(value *SecurityConfig, password string) error {
|
||||
if len([]rune(password)) < value.PwdMinLength {
|
||||
return errors.New("密码长度不足")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user