mirror of
https://github.com/simple-login/app.git
synced 2024-11-13 07:31:12 +01:00
use {word1}_{word2}{digits} as random alias address instead of {word1}{word2}{digits} (#1673)
This commit is contained in:
parent
1f9d784382
commit
03e5083d97
2 changed files with 3 additions and 3 deletions
|
@ -32,8 +32,8 @@ def random_words(words: int = 2, numbers: int = 0):
|
|||
fields = [secrets.choice(_words) for i in range(words)]
|
||||
|
||||
if numbers > 0:
|
||||
fields.append("".join([str(random.randint(0, 9)) for i in range(numbers)]))
|
||||
return "".join(fields)
|
||||
digits = "".join([str(random.randint(0, 9)) for i in range(numbers)])
|
||||
return "_".join(fields) + digits
|
||||
else:
|
||||
return "_".join(fields)
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ def test_random_words():
|
|||
assert s.count("_") == 1
|
||||
assert len(s) > 3
|
||||
s = random_words(2, 3)
|
||||
assert s.count("_") == 0
|
||||
assert s.count("_") == 1
|
||||
assert s[-1] in (str(i) for i in range(10))
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue