diff --git a/bump/bump.py b/bump/bump.py index b13b7b2..b880746 100644 --- a/bump/bump.py +++ b/bump/bump.py @@ -76,12 +76,17 @@ class Bump: return secrets def generate_secret(self, secrets_file): + pattern = re.compile('^[a-zA-Z]+$') WORDS = r.get_random_words() secret = "" - for _ in range(SENDER_LENGTH + PASSWORD_LENGTH): - secret += random.choice(WORDS) + "-" - while len(secret[SENDER_LENGTH:]) < 32: - secret += random.choice(WORDS) + "-" + word_count = 0 + while word_count < SENDER_LENGTH + PASSWORD_LENGTH or len(secret[SENDER_LENGTH:]) < 32: + word = random.choice(WORDS) + print(pattern.match(word)) + if pattern.match(word) and len(word) < 10: + secret += word + "-" + word_count += 1 + secret = secret[:-1] self.secrets.append(secret) diff --git a/setup.py b/setup.py index e59614c..0d4a40f 100644 --- a/setup.py +++ b/setup.py @@ -12,6 +12,7 @@ setup( license='MIT', install_requires=[ 'wheel', + 'regex', 'requests', 'pybase64', 'qrcode',