MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / checkPasswordPattern

Function checkPasswordPattern

agent/init/validator/validator.go:36–57  ·  view source on GitHub ↗
(fl validator.FieldLevel)

Source from the content-addressed store, hash-verified

34}
35
36func checkPasswordPattern(fl validator.FieldLevel) bool {
37 value := fl.Field().String()
38 if len(value) < 8 || len(value) > 30 {
39 return false
40 }
41
42 hasNum := false
43 hasLetter := false
44 for _, r := range value {
45 if unicode.IsLetter(r) && !hasLetter {
46 hasLetter = true
47 }
48 if unicode.IsNumber(r) && !hasNum {
49 hasNum = true
50 }
51 if hasLetter && hasNum {
52 return true
53 }
54 }
55
56 return false
57}

Callers

nothing calls this directly

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected