调整UI结构,优化密码设置逻辑
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
// 首次启动强制设置管理员账户
|
||||
|
||||
Reference in New Issue
Block a user