feat: 重建 Sense 认证权限与审计 (#64)

This commit is contained in:
QiuSW
2026-08-14 12:03:10 +08:00
parent c515f00319
commit 0411aa37c5
32 changed files with 509 additions and 123 deletions
@@ -0,0 +1,23 @@
package service
import (
"errors"
"unicode/utf8"
)
const (
MinPasswordLength = 6
MaxPasswordBytes = 72
)
// ValidatePassword enforces the frozen Sense policy. Lowercase-only passwords
// are valid; complexity rules are intentionally not added here.
func ValidatePassword(password string) error {
if utf8.RuneCountInString(password) < MinPasswordLength {
return errors.New("密码至少需要 6 个字符")
}
if len(password) > MaxPasswordBytes {
return errors.New("密码不能超过 72 个字节")
}
return nil
}