File tree 1 file changed +7
-5
lines changed
1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -63,15 +63,17 @@ def make_secure_key(key_info):
63
63
key = key_info ['variable' ]
64
64
original = key_info ['original' ]
65
65
66
- chars = '0123456789'
67
- chars += 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
68
- chars += '!@#%^&*()'
69
- chars += '-_ []{}<>~`+=,.;:/?|'
66
+ # These are the legal password characters
67
+ # as per the Django source code
68
+ # (django/contrib/auth/models.py)
69
+ chars = 'abcdefghjkmnpqrstuvwxyz'
70
+ chars += 'ABCDEFGHJKLMNPQRSTUVWXYZ'
71
+ chars += '23456789'
70
72
71
73
# Use the hash to seed the RNG
72
74
random .seed (int ("0x" + hashcode [:8 ], 0 ))
73
75
74
- # Create a random string the same length as the default
76
+ # Create a random string the same length as the default
75
77
rand_key = ''
76
78
for _ in range (len (original )):
77
79
rand_pos = random .randint (0 ,len (chars ))
You can’t perform that action at this time.
0 commit comments