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 }