mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-10-29 17:58:36 +08:00
Automatic merge from release/2.6.0 -> release/2.7.0
* commit '7f8ea1b23e99bbe92d24a1b749a11f529a02724a': 避免腾讯云使用以/开头的密码
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user