forked from CGM_Public/pretix_original
Do not offer to create a new customer account if a membership is required
This commit is contained in:
@@ -254,6 +254,14 @@ class CustomerStep(QuestionsViewMixin, CartMixin, TemplateFlowStep):
|
|||||||
field.widget.is_required = False
|
field.widget.is_required = False
|
||||||
return f
|
return f
|
||||||
|
|
||||||
|
@cached_property
|
||||||
|
def signup_allowed(self):
|
||||||
|
return not any(
|
||||||
|
p.item.require_membership or
|
||||||
|
(p.variation and p.variation.require_membership)
|
||||||
|
for p in self.positions
|
||||||
|
)
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def guest_allowed(self):
|
def guest_allowed(self):
|
||||||
return not any(
|
return not any(
|
||||||
@@ -330,6 +338,7 @@ class CustomerStep(QuestionsViewMixin, CartMixin, TemplateFlowStep):
|
|||||||
self.cart_session.get('customer_mode', 'login' if self.request.customer else '')
|
self.cart_session.get('customer_mode', 'login' if self.request.customer else '')
|
||||||
)
|
)
|
||||||
ctx['guest_allowed'] = self.guest_allowed
|
ctx['guest_allowed'] = self.guest_allowed
|
||||||
|
ctx['signup_allowed'] = self.signup_allowed
|
||||||
|
|
||||||
if 'customer' in self.cart_session:
|
if 'customer' in self.cart_session:
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<h4 class="panel-title">
|
<h4 class="panel-title">
|
||||||
<input type="radio" name="customer_mode" value="login"
|
<input type="radio" name="customer_mode" value="login"
|
||||||
data-parent="#customer"
|
data-parent="#customer"
|
||||||
{% if selected == "login" %}checked="checked"{% endif %}
|
{% if selected == "login" or not signup_allowed %}checked="checked"{% endif %}
|
||||||
data-toggle="radiocollapse" data-target="#customer_login"/>
|
data-toggle="radiocollapse" data-target="#customer_login"/>
|
||||||
<strong>
|
<strong>
|
||||||
{% trans "Log in with a customer account" %}
|
{% trans "Log in with a customer account" %}
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
<div id="customer_login"
|
<div id="customer_login"
|
||||||
class="panel-collapse collapsed {% if selected == "login" %}in{% endif %}">
|
class="panel-collapse collapsed {% if selected == "login" or not signup_allowed %}in{% endif %}">
|
||||||
<div class="panel-body form-horizontal">
|
<div class="panel-body form-horizontal">
|
||||||
{% if customer %}
|
{% if customer %}
|
||||||
<p>
|
<p>
|
||||||
@@ -65,34 +65,36 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel panel-default">
|
{% if signup_allowed %}
|
||||||
<label class="accordion-radio">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<label class="accordion-radio">
|
||||||
<h4 class="panel-title">
|
<div class="panel-heading">
|
||||||
<input type="radio" name="customer_mode" value="register"
|
<h4 class="panel-title">
|
||||||
data-parent="#customer"
|
<input type="radio" name="customer_mode" value="register"
|
||||||
{% if selected == "register" %}checked="checked"{% endif %}
|
data-parent="#customer"
|
||||||
data-toggle="radiocollapse" data-target="#customer_register"/>
|
{% if selected == "register" %}checked="checked"{% endif %}
|
||||||
<strong>
|
data-toggle="radiocollapse" data-target="#customer_register"/>
|
||||||
{% trans "Create a new customer account" %}
|
<strong>
|
||||||
</strong>
|
{% trans "Create a new customer account" %}
|
||||||
</h4>
|
</strong>
|
||||||
</div>
|
</h4>
|
||||||
</label>
|
</div>
|
||||||
<div id="customer_register"
|
</label>
|
||||||
class="panel-collapse collapsed {% if selected == "register" %}in{% endif %}">
|
<div id="customer_register"
|
||||||
<div class="panel-body form-horizontal">
|
class="panel-collapse collapsed {% if selected == "register" %}in{% endif %}">
|
||||||
{% bootstrap_form register_form layout="checkout" %}
|
<div class="panel-body form-horizontal">
|
||||||
<p>
|
{% bootstrap_form register_form layout="checkout" %}
|
||||||
{% blocktrans trimmed with org=request.organizer.name %}
|
<p>
|
||||||
We will send you an email with a link to activate your account and set a password, so
|
{% blocktrans trimmed with org=request.organizer.name %}
|
||||||
you can use the account for future orders at {{ org }}. You can still go ahead with this
|
We will send you an email with a link to activate your account and set a password, so
|
||||||
purchase before you received the email.
|
you can use the account for future orders at {{ org }}. You can still go ahead with this
|
||||||
{% endblocktrans %}
|
purchase before you received the email.
|
||||||
</p>
|
{% endblocktrans %}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{% endif %}
|
||||||
{% if guest_allowed %}
|
{% if guest_allowed %}
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<label class="accordion-radio">
|
<label class="accordion-radio">
|
||||||
|
|||||||
Reference in New Issue
Block a user