Adds customizable invite request copy

This commit is contained in:
Mouse Reeve 2021-09-18 15:42:48 -07:00
parent 1be4f31a9e
commit 38c66b208c
5 changed files with 71 additions and 32 deletions

View file

@ -0,0 +1,27 @@
# Generated by Django 3.2.4 on 2021-09-18 22:38
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("bookwyrm", "0097_auto_20210917_1858"),
]
operations = [
migrations.AddField(
model_name="sitesettings",
name="invite_request_text",
field=models.TextField(
default="If your request is approved, you will receive an email with a registration link."
),
),
migrations.AlterField(
model_name="sitesettings",
name="registration_closed_text",
field=models.TextField(
default='We aren\'t taking new users at this time. You can find an open instance at <a href="https://joinbookwyrm.com/instances">joinbookwyrm.com/instances</a>.'
),
),
]

View file

@ -24,7 +24,10 @@ class SiteSettings(models.Model):
# about page
registration_closed_text = models.TextField(
default="Contact an administrator to get an invite"
default='We aren\'t taking new users at this time. You can find an open instance at <a href="https://joinbookwyrm.com/instances">joinbookwyrm.com/instances</a>.'
)
invite_request_text = models.TextField(
default="If your request is approved, you will receive an email with a registration link."
)
code_of_conduct = models.TextField(default="Add a code of conduct here.")
privacy_policy = models.TextField(default="Add a privacy policy here.")

View file

@ -40,38 +40,41 @@
<div class="tile is-5 is-parent">
{% if not request.user.is_authenticated %}
<div class="tile is-child box has-background-primary-light content">
<h2 class="title">
{% if site.allow_registration %}
{% blocktrans with name=site.name %}Join {{ name }}{% endblocktrans %}
{% elif site.allow_invite_requests %}
{% trans "Request an Invitation" %}
{% else %}
{% blocktrans with name=site.name%}{{ name}} registration is closed{% endblocktrans %}
{% endif %}
</h2>
{% if site.allow_registration %}
<h2 class="title">{% blocktrans with name=site.name %}Join {{ name }}{% endblocktrans %}</h2>
<form name="register" method="post" action="/register">
{% include 'snippets/register_form.html' %}
</form>
<form name="register" method="post" action="/register">
{% include 'snippets/register_form.html' %}
</form>
{% elif site.allow_invite_requests %}
{% if request_received %}
<p>
{% trans "Thank you! Your request has been received." %}
</p>
{% else %}
<p>{{ site.invite_request_text }}<p>
<form name="invite-request" action="{% url 'invite-request' %}" method="post">
{% csrf_token %}
<div class="block">
<label for="id_request_email" class="label">{% trans "Email address:" %}</label>
<input type="email" name="email" maxlength="255" class="input" required="" id="id_request_email">
{% for error in request_form.email.errors %}
<p class="help is-danger">{{ error|escape }}</p>
{% endfor %}
</div>
<button type="submit" class="button is-link">{% trans "Submit" %}</button>
</form>
{% endif %}
{% else %}
<h2 class="title">{% trans "This instance is closed" %}</h2>
<p>{{ site.registration_closed_text|safe}}</p>
{% if site.allow_invite_requests %}
{% if request_received %}
<p>
{% trans "Thank you! Your request has been received." %}
</p>
{% else %}
<h3>{% trans "Request an Invitation" %}</h3>
<form name="invite-request" action="{% url 'invite-request' %}" method="post">
{% csrf_token %}
<div class="block">
<label for="id_request_email" class="label">{% trans "Email address:" %}</label>
<input type="email" name="email" maxlength="255" class="input" required="" id="id_request_email">
{% for error in request_form.email.errors %}
<p class="help is-danger">{{ error|escape }}</p>
{% endfor %}
</div>
<button type="submit" class="button is-link">{% trans "Submit" %}</button>
</form>
{% endif %}
{% endif %}
<p>{{ site.registration_closed_text|safe}}</p>
{% endif %}
</div>
{% else %}

View file

@ -107,6 +107,13 @@
<label class="label" for="id_registration_closed_text">{% trans "Registration closed text:" %}</label>
{{ site_form.registration_closed_text }}
</div>
<div class="field">
<label class="label" for="id_invite_request_text">{% trans "Invite request text:" %}</label>
{{ site_form.invite_request_text }}
{% for error in site_form.invite_request_text.errors %}
<p class="help is-danger">{{ error|escape }}</p>
{% endfor %}
</div>
</section>
<footer class="block">

View file

@ -20,7 +20,6 @@ class Register(View):
"""whether or not you're logged in, just go to the home view"""
return redirect("/")
@sensitive_variables("password")
@method_decorator(sensitive_post_parameters("password"))
def post(self, request):