MCPcopy Create free account
hub / github.com/tbphp/gpt-load / hasGoodComplexity

Function hasGoodComplexity

internal/handler/dashboard_handler.go:363–395  ·  view source on GitHub ↗

hasGoodComplexity 检查密码复杂度

(password string)

Source from the content-addressed store, hash-verified

361
362// hasGoodComplexity 检查密码复杂度
363func hasGoodComplexity(password string) bool {
364 var hasUpper, hasLower, hasDigit, hasSpecial bool
365
366 for _, char := range password {
367 switch {
368 case char >= 'A' && char <= 'Z':
369 hasUpper = true
370 case char >= 'a' && char <= 'z':
371 hasLower = true
372 case char >= '0' && char <= '9':
373 hasDigit = true
374 case !((char >= 'A' && char <= 'Z') || (char >= 'a' && char <= 'z') || (char >= '0' && char <= '9')):
375 hasSpecial = true
376 }
377 }
378
379 // 至少包含3种类型的字符
380 count := 0
381 if hasUpper {
382 count++
383 }
384 if hasLower {
385 count++
386 }
387 if hasDigit {
388 count++
389 }
390 if hasSpecial {
391 count++
392 }
393
394 return count >= 3
395}
396
397// Encryption scenario types
398const (

Callers 1

checkPasswordSecurityFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected