From edd26e3f75c31594f7f0f160f30a2f3117ad087b Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Fri, 5 Jan 2024 13:57:32 -0500 Subject: [PATCH] membershipworks: Collapse sequential periods in ucsAccounts usernames --- membershipworks/tasks/ucsAccounts.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/membershipworks/tasks/ucsAccounts.py b/membershipworks/tasks/ucsAccounts.py index d3e90ec..14e642b 100644 --- a/membershipworks/tasks/ucsAccounts.py +++ b/membershipworks/tasks/ucsAccounts.py @@ -22,7 +22,7 @@ GROUPS_REGEX = "|".join( # A group name must start and end with a letter, number or underscore. # In between additionally spaces, dashes and dots are allowed. def sanitize_group_name(name): - sanitized_body = re.sub(r"[^0-9A-Za-z_ -.]", ".", name) + sanitized_body = re.sub(r"[^0-9A-Za-z_ -.]+", ".", name) sanitized_start_end = re.sub("^[^0-9A-Za-z_]|[^0-9A-Za-z_]$", "_", sanitized_body) return "MW_" + sanitized_start_end @@ -30,7 +30,7 @@ def sanitize_group_name(name): # From an API error message: "Username must only contain numbers, letters and dots!" def sanitize_user_name(name): - return re.sub(r"[^0-9a-z.]", ".", name.lower()).strip(".") + return re.sub(r"[^0-9a-z.]+", ".", name.lower()).strip(".") async def make_groups(udm):