MCPcopy Index your code
hub / github.com/1Panel-dev/1Panel / checkPasswordPattern

Function checkPasswordPattern

core/init/validator/validator.go:76–97  ·  view source on GitHub ↗
(fl validator.FieldLevel)

Source from the content-addressed store, hash-verified

74}
75
76func checkPasswordPattern(fl validator.FieldLevel) bool {
77 value := fl.Field().String()
78 if len(value) < 8 || len(value) > 30 {
79 return false
80 }
81
82 hasNum := false
83 hasLetter := false
84 for _, r := range value {
85 if unicode.IsLetter(r) && !hasLetter {
86 hasLetter = true
87 }
88 if unicode.IsNumber(r) && !hasNum {
89 hasNum = true
90 }
91 if hasLetter && hasNum {
92 return true
93 }
94 }
95
96 return false
97}
98
99func checkBaseSettingKey(fl validator.FieldLevel) bool {
100 _, ok := baseSettingKeys[fl.Field().String()]

Callers

nothing calls this directly

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected