mirror of
https://github.com/pretix/pretix.git
synced 2026-05-05 15:14:04 +00:00
Allow to require a verified email to download tickets
This commit is contained in:
@@ -589,6 +589,7 @@ class EventSettingsSerializer(serializers.Serializer):
|
||||
'ticket_download_addons',
|
||||
'ticket_download_nonadm',
|
||||
'ticket_download_pending',
|
||||
'ticket_download_require_validated_email',
|
||||
'mail_prefix',
|
||||
'mail_from',
|
||||
'mail_from_name',
|
||||
|
||||
@@ -2067,7 +2067,7 @@ class OrderPosition(AbstractPosition):
|
||||
user: User=None, headers: dict=None, sender: str=None, invoices: list=None,
|
||||
auth=None, attach_tickets=False):
|
||||
"""
|
||||
Sends an email to the user that placed this order. Basically, this method does two things:
|
||||
Sends an email to the attendee. Basically, this method does two things:
|
||||
|
||||
* Call ``pretix.base.services.mail.mail`` with useful values for the ``event``, ``locale``, ``recipient`` and
|
||||
``order`` parameters.
|
||||
|
||||
@@ -971,6 +971,19 @@ DEFAULTS = {
|
||||
'data-checkbox-dependency-visual': 'on'}),
|
||||
)
|
||||
},
|
||||
'ticket_download_require_validated_email': {
|
||||
'default': 'False',
|
||||
'type': bool,
|
||||
'serializer_class': serializers.BooleanField,
|
||||
'form_class': forms.BooleanField,
|
||||
'form_kwargs': dict(
|
||||
label=_("Do not issue ticket before email address is validated"),
|
||||
help_text=_("If turned on, tickets will not be offered for download directly after purchase. They will "
|
||||
"be attached to the payment confirmation email (if the file size is not too large), and the "
|
||||
"customer will be able to download them from the page as soon as they clicked a link in "
|
||||
"the email. Does not affect orders performed through other sales channels."),
|
||||
)
|
||||
},
|
||||
'event_list_availability': {
|
||||
'default': 'True',
|
||||
'type': bool
|
||||
|
||||
@@ -1067,6 +1067,7 @@ class TicketSettingsForm(SettingsForm):
|
||||
'ticket_download_addons',
|
||||
'ticket_download_nonadm',
|
||||
'ticket_download_pending',
|
||||
'ticket_download_require_validated_email',
|
||||
]
|
||||
|
||||
def prepare_fields(self):
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
{% bootstrap_field form.ticket_download_addons layout="control" horizontal_label_class='sr-only' horizontal_field_class='col-md-12' %}
|
||||
{% bootstrap_field form.ticket_download_nonadm layout="control" horizontal_label_class='sr-only' horizontal_field_class='col-md-12' %}
|
||||
{% bootstrap_field form.ticket_download_pending layout="control" horizontal_label_class='sr-only' horizontal_field_class='col-md-12' %}
|
||||
{% bootstrap_field form.ticket_download_require_validated_email layout="control" horizontal_label_class='sr-only' horizontal_field_class='col-md-12' %}
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend>{% trans "Download formats" %}</legend>
|
||||
|
||||
@@ -1,6 +1,33 @@
|
||||
{% load i18n %}
|
||||
{% load eventurl %}
|
||||
{% if can_download and download_buttons and order.count_positions %}
|
||||
{% if download_email_required %}
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">
|
||||
{% trans "Ticket download" %}
|
||||
</h3>
|
||||
</div>
|
||||
<div class="panel-body text-center">
|
||||
<h4>
|
||||
<span class="fa fa-envelope text-muted fa-2x"></span><br><br>
|
||||
{% trans "Please check your email account, we've sent you your tickets." %}
|
||||
</h4>
|
||||
<p class="text-muted">
|
||||
{% if scope == "position" %}
|
||||
{% blocktrans trimmed %}
|
||||
You can also download them right here as soon as the person who placed the order clicked the
|
||||
link in the email they received to confirm the email address is valid.
|
||||
{% endblocktrans %}
|
||||
{% else %}
|
||||
{% blocktrans trimmed %}
|
||||
If the email has no attachment, click the link in our email and you will be able to download
|
||||
them from here.
|
||||
{% endblocktrans %}
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{% elif can_download and download_buttons and order.count_positions %}
|
||||
<div class="alert alert-info info-download">
|
||||
{% if cart.positions|length > 1 and can_download_multi %}
|
||||
{% blocktrans trimmed %}
|
||||
@@ -14,7 +41,7 @@
|
||||
{% for b in download_buttons %}
|
||||
{% if b.multi %}
|
||||
<form action="{% eventurl event "presale:event.order.download.combined" secret=order.secret order=order.code output=b.identifier %}"
|
||||
method="post" data-asynctask data-asynctask-download class="download-btn-form">
|
||||
method="post" data-asynctask data-asynctask-download class="download-btn-form">
|
||||
{% csrf_token %}
|
||||
<button type="submit"
|
||||
class="btn btn-lg {% if b.identifier == "pdf" %}btn-primary{% else %}btn-default{% endif %}">
|
||||
@@ -24,7 +51,7 @@
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</p>
|
||||
{% elif tickets_with_download|length == 1 %}
|
||||
{% elif tickets_with_download|length == 1 %}
|
||||
{% blocktrans trimmed %}
|
||||
Please have your ticket ready when entering the event.
|
||||
{% endblocktrans %}
|
||||
@@ -33,8 +60,11 @@
|
||||
{% endblocktrans %}
|
||||
<p class="info-download">
|
||||
{% for b in download_buttons %}
|
||||
<form action="{% if position_page and tickets_with_download.0.addon_to %}{% eventurl event "presale:event.order.position.download" secret=tickets_with_download.0.addon_to.web_secret order=order.code output=b.identifier pid=tickets_with_download.0.pk position=tickets_with_download.0.addon_to.positionid %}{% elif position_page %}{% eventurl event "presale:event.order.position.download" secret=tickets_with_download.0.web_secret order=order.code output=b.identifier pid=tickets_with_download.0.pk position=tickets_with_download.0.positionid %}{% else %}{% eventurl event "presale:event.order.download" secret=order.secret order=order.code output=b.identifier position=tickets_with_download.0.pk %}{% endif %}"
|
||||
method="post" data-asynctask data-asynctask-download class="download-btn-form{% if b.javascript_required %} requirejs{% endif %}">
|
||||
<form action="
|
||||
|
||||
{% if position_page and tickets_with_download.0.addon_to %}{% eventurl event "presale:event.order.position.download" secret=tickets_with_download.0.addon_to.web_secret order=order.code output=b.identifier pid=tickets_with_download.0.pk position=tickets_with_download.0.addon_to.positionid %}{% elif position_page %}{% eventurl event "presale:event.order.position.download" secret=tickets_with_download.0.web_secret order=order.code output=b.identifier pid=tickets_with_download.0.pk position=tickets_with_download.0.positionid %}{% else %}{% eventurl event "presale:event.order.download" secret=order.secret order=order.code output=b.identifier position=tickets_with_download.0.pk %}{% endif %}"
|
||||
method="post" data-asynctask data-asynctask-download
|
||||
class="download-btn-form{% if b.javascript_required %} requirejs{% endif %}">
|
||||
{% csrf_token %}
|
||||
<button type="submit"
|
||||
class="btn btn-lg {% if b.identifier == "pdf" %}btn-primary{% else %}btn-default{% endif %}">
|
||||
@@ -52,7 +82,7 @@
|
||||
{% endblocktrans %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% elif not download_buttons and ticket_download_date %}
|
||||
{% elif not download_buttons and ticket_download_date %}
|
||||
{% if order.status == 'p' %}
|
||||
<div class="alert alert-info info-download">
|
||||
{% blocktrans trimmed with date=ticket_download_date|date:"SHORT_DATE_FORMAT" %}
|
||||
|
||||
@@ -163,7 +163,7 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% include "pretixpresale/event/fragment_downloads.html" %}
|
||||
{% include "pretixpresale/event/fragment_downloads.html" with scope="order" %}
|
||||
<div class="panel panel-primary cart">
|
||||
<div class="panel-heading">
|
||||
{% if order.can_modify_answers %}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<div class="clearfix"></div>
|
||||
</h2>
|
||||
{% eventsignal event "pretix.presale.signals.position_info_top" order=order position=position request=request %}
|
||||
{% include "pretixpresale/event/fragment_downloads.html" %}
|
||||
{% include "pretixpresale/event/fragment_downloads.html" with scope="position" %}
|
||||
<div class="panel panel-primary cart">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">
|
||||
|
||||
@@ -134,10 +134,17 @@ class TicketPageMixin:
|
||||
can_download = all([r for rr, r in allow_ticket_download.send(self.request.event, order=self.order)])
|
||||
if self.request.event.settings.ticket_download_date:
|
||||
ctx['ticket_download_date'] = self.order.ticket_download_date
|
||||
ctx['can_download'] = (
|
||||
can_download = (
|
||||
can_download and self.order.ticket_download_available and
|
||||
list(self.order.positions_with_tickets)
|
||||
)
|
||||
ctx['download_email_required'] = can_download and (
|
||||
self.request.event.settings.ticket_download_require_validated_email and
|
||||
self.order.sales_channel == 'web' and
|
||||
not self.order.email_known_to_work
|
||||
)
|
||||
ctx['can_download'] = can_download and not ctx['download_email_required']
|
||||
|
||||
ctx['download_buttons'] = self.download_buttons
|
||||
|
||||
ctx['backend_user'] = (
|
||||
@@ -874,6 +881,13 @@ class OrderDownloadMixin:
|
||||
if 'position' in kwargs and not self.order_position.generate_ticket:
|
||||
return self.error(OrderError(_('Ticket download is not enabled for this product.')))
|
||||
|
||||
if (
|
||||
self.request.event.settings.ticket_download_require_validated_email and
|
||||
self.order.sales_channel == 'web' and
|
||||
not self.order.email_known_to_work
|
||||
):
|
||||
return self.error(OrderError(_('Please click the link we sent you via email to download your tickets.')))
|
||||
|
||||
ct = self.get_last_ct()
|
||||
if ct:
|
||||
return self.success(ct)
|
||||
|
||||
Reference in New Issue
Block a user