mirror of
https://gitee.com/dromara/mayfly-go
synced 2026-01-03 13:16:35 +08:00
feat: i18n
This commit is contained in:
@@ -10,19 +10,16 @@ func CheckAccountPasswordLever(ps string) bool {
|
||||
if len(ps) < 8 {
|
||||
return false
|
||||
}
|
||||
num := `[0-9]{1}`
|
||||
a_z := `[a-zA-Z]{1}`
|
||||
symbol := `[!@#~$%^&*()+|_.,]{1}`
|
||||
if b, err := regexp.MatchString(num, ps); !b || err != nil {
|
||||
return false
|
||||
}
|
||||
if b, err := regexp.MatchString(a_z, ps); !b || err != nil {
|
||||
return false
|
||||
}
|
||||
if b, err := regexp.MatchString(symbol, ps); !b || err != nil {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
// 包含大写字母
|
||||
charRegex := regexp.MustCompile(`[a-zA-Z]`)
|
||||
// 包含数字
|
||||
digitRegex := regexp.MustCompile(`[0-9]`)
|
||||
// 包含特殊符号
|
||||
specialCharRegex := regexp.MustCompile(`[!@#$%^&*(),.?":{}|<>]`)
|
||||
|
||||
return charRegex.MatchString(ps) &&
|
||||
digitRegex.MatchString(ps) &&
|
||||
specialCharRegex.MatchString(ps)
|
||||
}
|
||||
|
||||
// 使用config.yml的aes.key进行密码加密
|
||||
|
||||
Reference in New Issue
Block a user