mirror of
https://github.com/janeczku/calibre-web.git
synced 2024-11-26 08:51:05 +02:00
Generate strong random passwords
This commit is contained in:
parent
189243a9b0
commit
2a1bf2fa71
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user