From 9b6dfa9cdc0557f3797d9e37879e9d2db5038cc6 Mon Sep 17 00:00:00 2001 From: cliffmccarthy <16453869+cliffmccarthy@users.noreply.github.com> Date: Tue, 5 Aug 2025 16:53:39 -0500 Subject: [PATCH] Use max username length in newemail.py, not min - username_min_length and username_max_length are both set to a default value of 9 in the chatmail.ini.f template. When they have the same value, it doesn't matter which one we use in newemail.py (which handles the /new URL). However, if they are configured to different values by the admin, then the current implementation using username_min_length chooses from a smaller set of possible usernames. - Revised create_newemail_dict() in newemail.py to use username_max_length as the length of the random username it offers via the /new URL. This randomizes within a much larger set of possible usernames. --- chatmaild/src/chatmaild/newemail.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chatmaild/src/chatmaild/newemail.py b/chatmaild/src/chatmaild/newemail.py index fbf976af..67bd861a 100644 --- a/chatmaild/src/chatmaild/newemail.py +++ b/chatmaild/src/chatmaild/newemail.py @@ -15,7 +15,7 @@ ALPHANUMERIC_PUNCT = string.ascii_letters + string.digits + string.punctuation def create_newemail_dict(config: Config): - user = "".join(random.choices(ALPHANUMERIC, k=config.username_min_length)) + user = "".join(random.choices(ALPHANUMERIC, k=config.username_max_length)) password = "".join( secrets.choice(ALPHANUMERIC_PUNCT) for _ in range(config.password_min_length + 3)