feat: unify email identity and administrator security
Docker Release / Check web and api (push) Waiting to run
Docker Release / Resolve release tag (push) Blocked by required conditions
Docker Release / Build and publish all-in-one (push) Blocked by required conditions
Docker Release / Build and publish api (push) Blocked by required conditions
Docker Release / Build and publish web (push) Blocked by required conditions
Docker Release / Build and publish dovecot (push) Blocked by required conditions
Docker Release / Build and publish postfix (push) Blocked by required conditions
Docker Release / Build and publish rspamd (push) Blocked by required conditions
Docker Release / Create GitHub release (push) Blocked by required conditions

This commit is contained in:
zxyszx
2026-08-05 02:55:36 +08:00
parent a11e1cd2f1
commit 86773c64ca
32 changed files with 1816 additions and 402 deletions
+15
View File
@@ -205,6 +205,21 @@ func cleanUsername(value string) (string, error) {
return username, nil
}
func cleanPrimaryEmail(value string) (string, error) {
email := normalizeEmail(value)
if email == "" || !strings.Contains(email, "@") {
return "", errors.New("邮箱地址无效")
}
parts := strings.SplitN(email, "@", 2)
if len(parts) != 2 || parts[0] == "" || parts[1] == "" {
return "", errors.New("邮箱地址无效")
}
if len([]rune(email)) > 254 {
return "", errors.New("邮箱地址不能超过 254 个字符")
}
return email, nil
}
func dedupeEmails(items []string) []string {
seen := map[string]bool{}
out := make([]string, 0, len(items))