Automatic merge from release/2.5.0 -> release/2.6.0

* commit '7974b7127f490c40b19b7fb20621b74df1162f77':
  避免腾讯云使用以/开头的密码
This commit is contained in:
邱剑
2019-03-15 14:52:11 +08:00
+9 -2
View File
@@ -36,8 +36,15 @@ func RandomPassword2(width int) string {
ps := PasswordStrength{}
var buf bytes.Buffer
for i := 0; i < width; i += 1 {
index := rand.Intn(len(CHARS))
ch := CHARS[index]
var ch byte
for {
index := rand.Intn(len(CHARS))
ch = CHARS[index]
if i == 0 && ch == '/' {
continue
}
break
}
if strings.IndexByte(DIGITS, ch) >= 0 {
ps.Digits += 1
} else if strings.IndexByte(LETTERS, ch) >= 0 {