mirror of
https://github.com/janeczku/calibre-web
synced 2024-11-24 18:47:23 +00:00
Fix #1507 (Password generation on python2 working again)
This commit is contained in:
parent
a14192b7e0
commit
8608ff11f7
@ -466,7 +466,10 @@ def reset_password(user_id):
|
||||
def generate_random_password():
|
||||
s = "abcdefghijklmnopqrstuvwxyz01234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%&*()?"
|
||||
passlen = 8
|
||||
return "".join(s[c % len(s)] for c in os.urandom(passlen))
|
||||
if sys.version_info < (3, 0):
|
||||
return "".join(s[ord(c) % len(s)] for c in os.urandom(passlen))
|
||||
else:
|
||||
return "".join(s[c % len(s)] for c in os.urandom(passlen))
|
||||
|
||||
|
||||
def uniq(input):
|
||||
|
Loading…
Reference in New Issue
Block a user