Commit 5e9af441 authored by Jérome Perrin's avatar Jérome Perrin

base: generate a bit stronger passwords in Person_generatePassword

- use system random
- generate longer password

( I'm just updating since we now have system random, but this script
looks like something that should not be used )
parent f4777c63
......@@ -16,6 +16,7 @@
"""
import string, random
rng = random.SystemRandom()
vowels = ['a','e','i','o','u']
consonants = [a for a in string.ascii_lowercase if a not in vowels]
digits = string.digits
......@@ -24,17 +25,17 @@ def a_part(slen):
ret = ''
for i in range(slen):
if i%2 ==0:
randid = random.randint(0,20) #number of consonants
randid = rng.randint(0,20) #number of consonants
ret += consonants[randid]
else:
randid = random.randint(0,4) #number of vowels
randid = rng.randint(0,4) #number of vowels
ret += vowels[randid]
return ret
def n_part(slen):
ret = ''
for i in range(slen):
randid = random.randint(0,9) #number of digits
randid = rng.randint(0,9) #number of digits
ret += digits[randid]
return ret
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>alpha=6, numeric=2</string> </value>
<value> <string>alpha=16, numeric=8</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
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