Skip to content

Commit

Permalink
ensure passwords start with a letter
Browse files Browse the repository at this point in the history
  • Loading branch information
frodopwns committed Apr 3, 2020
1 parent 3a3a581 commit 8a5138e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/helpers/stringhelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ func GenerateRandomUsername(n int) string {

b := make([]byte, n)

for i := 0; i < n; i++ {
// ensure first char is alpha
b[0] = lowerAlphaChars[seededRand.Intn(len(lowerAlphaChars))]

for i := 1; i < n; i++ {
b[i] = usernameChars[seededRand.Intn(len(usernameChars))]
}
// For good measure, shuffle the elements of the entire []byte so that
Expand All @@ -105,6 +108,7 @@ func GenerateRandomUsername(n int) string {
b[i], b[j] = b[j], b[i]
}
return string(b)

}

// GenerateRandomPassword - helper function to generate random password for sql server
Expand Down

0 comments on commit 8a5138e

Please sign in to comment.