mirror of
https://github.com/pretix/pretix.git
synced 2026-05-05 15:14:04 +00:00
* prevent some words from occurring in order codes * Use regex to match against blacklist * Prevent some words from occurring in voucher codes * Rename blacklist to banlist
This commit is contained in:
@@ -31,6 +31,7 @@ from django_scopes import ScopedManager, scopes_disabled
|
||||
from i18nfield.strings import LazyI18nString
|
||||
from jsonfallback.fields import FallbackJSONField
|
||||
|
||||
from pretix.base.banlist import banned
|
||||
from pretix.base.decimal import round_decimal
|
||||
from pretix.base.email import get_email_context
|
||||
from pretix.base.i18n import language
|
||||
@@ -538,6 +539,8 @@ class Order(LockModel, LoggedModel):
|
||||
charset = list('ABCDEFGHJKLMNPQRSTUVWXYZ3789')
|
||||
while True:
|
||||
code = get_random_string(length=settings.ENTROPY['order_code'], allowed_chars=charset)
|
||||
if banned(code):
|
||||
continue
|
||||
if self.testmode:
|
||||
# Subtle way to recognize test orders while debugging: They all contain a 0 at the second place,
|
||||
# even though zeros are not used outside test mode.
|
||||
|
||||
Reference in New Issue
Block a user