Do not allow slugs to start with a non-alphanumeric character

This commit is contained in:
Raphael Michel
2020-01-23 09:36:53 +01:00
parent bcd687764c
commit deff282a63
2 changed files with 2 additions and 2 deletions

View File

@@ -293,7 +293,7 @@ class Event(EventMixin, LoggedModel):
"This will be used in URLs, order codes, invoice numbers, and bank transfer references."),
validators=[
RegexValidator(
regex="^[a-zA-Z0-9.-]+$",
regex="^[a-zA-Z0-9][a-zA-Z0-9.-]+$",
message=_("The slug may only contain letters, numbers, dots and dashes."),
),
EventSlugBanlistValidator()

View File

@@ -37,7 +37,7 @@ class Organizer(LoggedModel):
"once. This is being used in URLs to refer to your organizer accounts and your events."),
validators=[
RegexValidator(
regex="^[a-zA-Z0-9.-]+$",
regex="^[a-zA-Z0-9][a-zA-Z0-9.-]+$",
message=_("The slug may only contain letters, numbers, dots and dashes.")
),
OrganizerSlugBanlistValidator()