From 2a1bf2fa71f349035b231459a156711139c2957e Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sat, 9 May 2020 14:24:20 +0200 Subject: [PATCH] Generate strong random passwords --- cps/helper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cps/helper.py b/cps/helper.py index c89bdf3d..56caf50c 100644 --- a/cps/helper.py +++ b/cps/helper.py @@ -466,7 +466,7 @@ def reset_password(user_id): def generate_random_password(): s = "abcdefghijklmnopqrstuvwxyz01234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%&*()?" passlen = 8 - return "".join(random.sample(s, passlen)) + return "".join(s[c % len(s)] for c in os.urandom(passlen)) ################################## External interface