Skip to content

Commit e18b9fb

Browse files
committed
Implement per-section notify saves
1 parent 7248ffb commit e18b9fb

6 files changed

Lines changed: 228 additions & 97 deletions

File tree

backend/internal/common/services/notify.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ func validateNotifyConfigForSave(form *forms.AdminUpdateNotifyConfigForm, hasSto
220220
if form.Mail.Port < 1 || form.Mail.Port > 65535 {
221221
return errors.New("启用邮件通知时,SMTP 端口范围必须为 1-65535")
222222
}
223-
if form.Mail.Password == "" {
223+
if form.Mail.Password == "" && !hasStoredMailPassword {
224224
return errors.New("启用邮件通知时,SMTP 密码不能为空")
225225
}
226226
}

backend/internal/common/services/notify_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,15 @@ func TestValidateNotifyConfigForSave(t *testing.T) {
107107
}
108108
})
109109

110-
t.Run("mail enabled without password should fail even with existing password", func(t *testing.T) {
110+
t.Run("mail enabled without new password should pass when existing password exists", func(t *testing.T) {
111111
form := buildValidNotifyForm()
112112
form.Mail.Enable = true
113113
form.Mail.Username = "ops@example.com"
114114
form.Mail.Host = "smtp.example.com"
115115
form.Mail.Port = 465
116116
form.Mail.Password = ""
117-
if err := validateNotifyConfigForSave(form, true); err == nil {
118-
t.Fatal("expected validation error")
117+
if err := validateNotifyConfigForSave(form, true); err != nil {
118+
t.Fatalf("unexpected validation error: %v", err)
119119
}
120120
})
121121

www/src/permission.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ NProgress.configure({ showSpinner: false })
1313
// 免登录白名单
1414
const WHITE_LIST = ['/login', '/403']
1515
// 默认路由
16-
const DEFAULT_ROUTE = '/das'
16+
const DEFAULT_ROUTE = '/account/basic'
1717

1818
/**
1919
* 路由前置守卫

0 commit comments

Comments
 (0)