mirror of https://github.com/zulip/zulip.git
accounts_accept_terms: Check if imported user wants marketing emails.
This commit is contained in:
parent
d18959b1b6
commit
cbb73bc82f
|
@ -59,6 +59,16 @@ the registration flow has its own (nearly identical) copy of the fields below in
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
{% if first_time_terms_of_service_message_template %}
|
||||||
|
<div class="input-group">
|
||||||
|
<label for="id_enable_marketing_emails_first_login" class="inline-block checkbox marketing_emails_checkbox">
|
||||||
|
<input id="id_enable_marketing_emails_first_login" type="checkbox" name="enable_marketing_emails"
|
||||||
|
checked="checked" />
|
||||||
|
<span class="rendered-checkbox"></span>
|
||||||
|
{% trans %}Subscribe me to Zulip's low-traffic newsletter (a few emails a year).{% endtrans %}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<button id="accept_tos_button" type="submit">{{ _('Continue') }}</button>
|
<button id="accept_tos_button" type="submit">{{ _('Continue') }}</button>
|
||||||
|
|
|
@ -234,6 +234,7 @@ class RegistrationForm(RealmDetailsForm):
|
||||||
|
|
||||||
class ToSForm(forms.Form):
|
class ToSForm(forms.Form):
|
||||||
terms = forms.BooleanField(required=False)
|
terms = forms.BooleanField(required=False)
|
||||||
|
enable_marketing_emails = forms.BooleanField(required=False)
|
||||||
email_address_visibility = forms.TypedChoiceField(
|
email_address_visibility = forms.TypedChoiceField(
|
||||||
required=False,
|
required=False,
|
||||||
coerce=int,
|
coerce=int,
|
||||||
|
|
|
@ -57,6 +57,18 @@ def accounts_accept_terms(request: HttpRequest) -> HttpResponse:
|
||||||
email_address_visibility,
|
email_address_visibility,
|
||||||
acting_user=request.user,
|
acting_user=request.user,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
enable_marketing_emails = form.cleaned_data["enable_marketing_emails"]
|
||||||
|
if (
|
||||||
|
enable_marketing_emails is not None
|
||||||
|
and enable_marketing_emails != request.user.enable_marketing_emails
|
||||||
|
):
|
||||||
|
do_change_user_setting(
|
||||||
|
request.user,
|
||||||
|
"enable_marketing_emails",
|
||||||
|
enable_marketing_emails,
|
||||||
|
acting_user=request.user,
|
||||||
|
)
|
||||||
return redirect(home)
|
return redirect(home)
|
||||||
else:
|
else:
|
||||||
form = ToSForm()
|
form = ToSForm()
|
||||||
|
|
Loading…
Reference in New Issue