mirror of
https://github.com/pretix/pretix.git
synced 2026-04-26 23:52:35 +00:00
Only allow letters, numbers, dots and dashes for giftcard codes
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from decimal import Decimal
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.validators import RegexValidator
|
||||
from django.db import models
|
||||
from django.db.models import Sum
|
||||
from django.utils.crypto import get_random_string
|
||||
@@ -50,6 +51,12 @@ class GiftCard(LoggedModel):
|
||||
max_length=190,
|
||||
db_index=True,
|
||||
verbose_name=_('Gift card code'),
|
||||
validators=[
|
||||
RegexValidator(
|
||||
regex="^[a-zA-Z0-9][a-zA-Z0-9.-]+$",
|
||||
message=_("The giftcard code may only contain letters, numbers, dots and dashes."),
|
||||
)
|
||||
],
|
||||
)
|
||||
testmode = models.BooleanField(
|
||||
verbose_name=_('Test mode card'),
|
||||
|
||||
Reference in New Issue
Block a user