调整UI结构,优化密码设置逻辑

This commit is contained in:
2026-07-23 18:34:59 +08:00
parent 8acbfa0f6a
commit e2785ef590
4 changed files with 380 additions and 245 deletions
+8 -8
View File
@@ -47,19 +47,19 @@ func ParseJWT(tokenString string) (*Claims, error) {
// 密码复杂度验证:至少3个大写 + 8个数字 + 1个特殊字符
func ValidatePassword(pwd string) bool {
var upper, digit, special int
if len(pwd) < 8 {
return false
}
var hasLetter, hasDigit bool
for _, ch := range pwd {
if ch >= 'A' && ch <= 'Z' {
upper++
if (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') {
hasLetter = true
}
if ch >= '0' && ch <= '9' {
digit++
}
if strings.ContainsAny(string(ch), "!@#$%^&*()_+-=[]{}|;:,.<>?") {
special++
hasDigit = true
}
}
return upper >= 3 && digit >= 8 && special >= 1 && len(pwd) >= 12
return hasLetter && hasDigit
}
// 首次启动强制设置管理员账户