Merge lp://staging/~rvb/gwacl/random-pw into lp://staging/gwacl

Proposed by Raphaël Badin
Status: Merged
Approved by: Raphaël Badin
Approved revision: 179
Merged at revision: 178
Proposed branch: lp://staging/~rvb/gwacl/random-pw
Merge into: lp://staging/gwacl
Diff against target: 92 lines (+53/-3)
2 files modified
names.go (+32/-3)
names_test.go (+21/-0)
To merge this branch: bzr merge lp://staging/~rvb/gwacl/random-pw
Reviewer Review Type Date Requested Status
Gavin Panella Approve
Review via email: mp+174200@code.staging.launchpad.net

Commit message

Add MakeRandomPassword utility.

Description of the change

Add utility to create a valid Azure password. We could do this in much clever ways but I think that this serves our purpose well enough and is pretty readable.

To post a comment you must log in.
Revision history for this message
Gavin Panella (allenap) wrote :

Looks good.

[1]

+const (
+    // Valid passwords must be 6-72 characters long.
+    passwordSize = 50
+)

According to http://www.universetoday.com/36302/atoms-in-the-universe/
this means that there are more possible password combinations than
there are atoms in the universe.

[2]

+    // Only digits and lower-case ASCII letters are accepted.
+    const (
+        chars = letters + digits + upperCaseLetters
+    )
+

The comment is incorrect. Also, you could dispense with the braces and
the blank line to try and claw back some of the losses incurred from
Go's syntax.

[3]

+    id := letter + upperCaseLetter + digit
+    for len(id) < passwordSize {
+        id += pickOne(chars)
+    }
+    return id

s/id/password/ ?

review: Approve
Revision history for this message
Raphaël Badin (rvb) wrote :

> Looks good.

Thanks for the review!

> [1]
>
> +const (
> +    // Valid passwords must be 6-72 characters long.
> +    passwordSize = 50
> +)
>
> According to http://www.universetoday.com/36302/atoms-in-the-universe/
> this means that there are more possible password combinations than
> there are atoms in the universe.

The more the merrier!
>
>
> [2]
>
> +    // Only digits and lower-case ASCII letters are accepted.
> +    const (
> +        chars = letters + digits + upperCaseLetters
> +    )
> +
>
> The comment is incorrect. Also, you could dispense with the braces and
> the blank line to try and claw back some of the losses incurred from
> Go's syntax.

Fixed.

> [3]
>
> +    id := letter + upperCaseLetter + digit
> +    for len(id) < passwordSize {
> +        id += pickOne(chars)
> +    }
> +    return id
>
> s/id/password/ ?

Okay, done.

lp://staging/~rvb/gwacl/random-pw updated
179. By Raphaël Badin

Review fixes.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to all changes: