there are at least three types of uppercase letters, lowercase characters, numbers, and special characters
(encryptPwd string)
| 78 | |
| 79 | // there are at least three types of uppercase letters, lowercase characters, numbers, and special characters |
| 80 | func VerifyPassword(encryptPwd string) bool { |
| 81 | realPassword, err := handler.DecryptPasswordSupportNoRsaKey(encryptPwd, g.RsaPrivateKey) |
| 82 | if err != nil { |
| 83 | return false |
| 84 | } |
| 85 | matchTimes := 0 |
| 86 | regexpSlice := []*regexp.Regexp{ |
| 87 | regexp.MustCompile(`[a-z]`), |
| 88 | regexp.MustCompile(`[A-Z]`), |
| 89 | regexp.MustCompile(`[0-9]`), |
| 90 | regexp.MustCompile(`[@#$%^&*()]`), |
| 91 | } |
| 92 | for i := range regexpSlice { |
| 93 | if regexpSlice[i].MatchString(realPassword) { |
| 94 | matchTimes += 1 |
| 95 | } |
| 96 | } |
| 97 | if matchTimes >= 3 && len(realPassword) >= 8 { |
| 98 | return true |
| 99 | } |
| 100 | return false |
| 101 | } |
no test coverage detected