mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-01 15:07:17 +08:00
Automatic merge from release/2.5.0 -> release/2.6.0
* commit '7974b7127f490c40b19b7fb20621b74df1162f77': 避免腾讯云使用以/开头的密码
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