forked from CGM_Public/pretix_original
Compare commits
3 Commits
dependabot
...
fix-mail-p
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb61bcdd4e | ||
|
|
1566f54764 | ||
|
|
9d380557e1 |
@@ -62,7 +62,10 @@ class VATIDTemporaryError(VATIDError):
|
||||
|
||||
def _validate_vat_id_NO(vat_id, country_code):
|
||||
# Inspired by vat_moss library
|
||||
vat_id = vat_moss.id.normalize(vat_id)
|
||||
try:
|
||||
vat_id = vat_moss.id.normalize(vat_id)
|
||||
except ValueError:
|
||||
raise VATIDFinalError(error_messages['invalid'])
|
||||
|
||||
if not vat_id or len(vat_id) < 3 or not re.match('^\\d{9}MVA$', vat_id[2:]):
|
||||
raise VATIDFinalError(error_messages['invalid'])
|
||||
|
||||
@@ -749,21 +749,40 @@ class MailSettingsPreview(EventPermissionRequiredMixin, View):
|
||||
if preview_item not in MailSettingsForm.base_context:
|
||||
return HttpResponseBadRequest(_('invalid item'))
|
||||
|
||||
regex = r"^" + re.escape(preview_item) + r"_(?P<idx>[\d]+)$"
|
||||
re_escape_single_bracket = r"((\{)[^\}]+\{|\}[^\{]+(\})|(\{)[^\}]*$|^[^\{]*(\}))"
|
||||
msgs = {}
|
||||
for k, v in request.POST.items():
|
||||
# only accept allowed fields
|
||||
matched = re.search(regex, k)
|
||||
if matched is not None:
|
||||
idx = matched.group('idx')
|
||||
if idx in self.supported_locale:
|
||||
with language(self.supported_locale[idx], self.request.event.settings.region):
|
||||
if k.startswith('mail_subject_'):
|
||||
msgs[self.supported_locale[idx]] = format_map(bleach.clean(v), self.placeholders(preview_item))
|
||||
else:
|
||||
msgs[self.supported_locale[idx]] = markdown_compile_email(
|
||||
format_map(v, self.placeholders(preview_item))
|
||||
)
|
||||
if not k.startswith(preview_item + "_"):
|
||||
continue
|
||||
idx = k[len(preview_item)+1:]
|
||||
if idx in self.supported_locale:
|
||||
cleaned_v = ""
|
||||
test_v = v.replace("{{", "__").replace("}}", "__")
|
||||
while True:
|
||||
match = re.search(re_escape_single_bracket, test_v)
|
||||
if not match:
|
||||
cleaned_v += v
|
||||
break
|
||||
if "{" in match.groups():
|
||||
# replace first occurrence of { with {{, but keep trailing { in testing string
|
||||
match_end = match.end()-1
|
||||
cleaned_v += v[:match_end].replace("{", "{{", 1)
|
||||
else:
|
||||
# replace last occurrence of } with }}
|
||||
match_end = match.end()
|
||||
cleaned_v += "}}".join(v[:match_end].rsplit("}", 1))
|
||||
|
||||
v = v[match_end:]
|
||||
test_v = test_v[match_end:]
|
||||
|
||||
with language(self.supported_locale[idx], self.request.event.settings.region):
|
||||
if k.startswith('mail_subject_'):
|
||||
msgs[self.supported_locale[idx]] = format_map(bleach.clean(cleaned_v), self.placeholders(preview_item))
|
||||
else:
|
||||
msgs[self.supported_locale[idx]] = markdown_compile_email(
|
||||
format_map(cleaned_v, self.placeholders(preview_item))
|
||||
)
|
||||
|
||||
return JsonResponse({
|
||||
'item': preview_item,
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
{% if social_image %}
|
||||
<meta property="og:image" content="{{ social_image }}" />
|
||||
{% endif %}
|
||||
{% if event.settings.google_site_verification %}
|
||||
<meta name="google-site-verification" content="{{ event.settings.google_site_verification }}" />
|
||||
{% endif %}
|
||||
{{ block.super }}
|
||||
{% endblock %}
|
||||
{% block above %}
|
||||
@@ -68,15 +71,23 @@
|
||||
{% block page %}
|
||||
<div class="page-header{% if event_logo %} pager-header-with-logo{% endif %}{% if event_logo and event_logo_image_large %} logo-large{% endif %}">
|
||||
<div class="{% if not event_logo or not event_logo_image_large %}pull-left flip{% endif %}">
|
||||
{% if event_logo and not event_logo_show_title %}
|
||||
<h1 class="sr-only">
|
||||
{{ event.name }}
|
||||
{% if request.event.settings.show_dates_on_frontpage and not event.has_subevents %}
|
||||
<small>{{ event.get_date_range_display_as_html }}</small>
|
||||
{% endif %}
|
||||
</h1>
|
||||
{% endif %}
|
||||
{% if event_logo and event_logo_image_large %}
|
||||
<a href="{% eventurl event "presale:event.index" cart_namespace=cart_namespace|default_if_none:"" %}"
|
||||
aria-label="{% trans 'Homepage' %}" title="{% trans 'Homepage' %}">
|
||||
<img src="{{ event_logo|thumb:'1170x5000' }}" alt="" class="event-logo" />
|
||||
<img src="{{ event_logo|thumb:'1170x5000' }}" alt="{{ event.name }}" class="event-logo" />
|
||||
</a>
|
||||
{% elif event_logo %}
|
||||
<a href="{% eventurl event "presale:event.index" cart_namespace=cart_namespace|default_if_none:"" %}"
|
||||
aria-label="{% trans 'Homepage' %}" title="{% trans 'Homepage' %}">
|
||||
<img src="{{ event_logo|thumb:'5000x120' }}" alt="" class="event-logo" />
|
||||
<img src="{{ event_logo|thumb:'5000x120' }}" alt="{{ event.name }}" class="event-logo" />
|
||||
</a>
|
||||
{% else %}
|
||||
<h1>
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
{% endif %}
|
||||
<meta property="og:type" content="website" />
|
||||
|
||||
{% if organizer.settings.google_site_verification %}
|
||||
<meta name="google-site-verification" content="{{ organizer.settings.google_site_verification }}" />
|
||||
{% endif %}
|
||||
{{ block.super }}
|
||||
{% endblock %}
|
||||
{% block above %}
|
||||
@@ -39,6 +43,11 @@
|
||||
{% block page %}
|
||||
<div class="page-header{% if organizer_logo %} pager-header-with-logo{% endif %}{% if organizer_logo and organizer.settings.organizer_logo_image_large %} logo-large{% endif %}">
|
||||
<div class="{% if not organizer_logo or not organizer.settings.organizer_logo_image_large %}pull-left flip{% endif %}">
|
||||
{% if organizer_logo %}
|
||||
<h1 class="sr-only">
|
||||
{{ organizer.name }}
|
||||
</h1>
|
||||
{% endif %}
|
||||
{% if organizer_logo and organizer.settings.organizer_logo_image_large %}
|
||||
<a href="{% eventurl organizer "presale:organizer.index" %}" title="{{ organizer.name }}">
|
||||
<img src="{{ organizer_logo|thumb:'1170x5000' }}" alt="{{ organizer.name }}"
|
||||
|
||||
Reference in New Issue
Block a user