membershipworks: Collapse sequential periods in ucsAccounts usernames
This commit is contained in:
parent
35d8fec2a3
commit
188824d53b
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user