完成安全整改与认证功能重构

This commit is contained in:
xuans committed 2026-08-27 21:51:51 +08:00
1 parent e91a64136b
commit 51767b9f5b
480 files changed
+57538 -7244

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
package main
import (
"testing"
"github.com/Jinnrry/pmail/utils/context"
)
func TestSettingsHtmlRejectsNonAdminSave(t *testing.T) {
s := &SpamBlock{}
result := s.SettingsHtml(&context.Context{}, "SpamBlock/save", `{"url":"https://model.example.com/predict"}`)
if result != "No Access Privileges" {
t.Fatalf("non-admin save result = %q, want access denial", result)
}
if s.cfg.ApiURL != "" {
t.Fatal("non-admin save changed the configuration")
}
}