Commit 88cb1b27 authored by Romain Courteaud's avatar Romain Courteaud

slapos.recipe.random: allow to use a character twice in a password

parent 09e3def5
...@@ -107,8 +107,9 @@ class Mac(object): ...@@ -107,8 +107,9 @@ class Mac(object):
pass pass
def generatePassword(length): def generatePassword(length):
return ''.join(random.SystemRandom().sample( system_random = random.SystemRandom()
string.ascii_letters + string.digits, length)) alphabet = string.ascii_letters + string.digits
return ''.join(system_random.choice(alphabet) for i in range(length))
class Password(object): class Password(object):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment