Commit 2a1bf2fa authored by jvoisin's avatar jvoisin

Generate strong random passwords

parent 189243a9
...@@ -466,7 +466,7 @@ def reset_password(user_id): ...@@ -466,7 +466,7 @@ def reset_password(user_id):
def generate_random_password(): def generate_random_password():
s = "abcdefghijklmnopqrstuvwxyz01234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%&*()?" s = "abcdefghijklmnopqrstuvwxyz01234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%&*()?"
passlen = 8 passlen = 8
return "".join(random.sample(s, passlen)) return "".join(s[c % len(s)] for c in os.urandom(passlen))
################################## External interface ################################## External interface
......
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