feat: Add legal links to registration views
Incorporates legal links in registration and email forms by updating views to fetch legal documents from configuration. Enhances compliance by ensuring users acknowledge terms of service during account setup.
This commit is contained in:
parent
e67e89a09b
commit
f3ad9c54fa
5 changed files with 32 additions and 0 deletions
|
@ -15,3 +15,6 @@ admin:
|
||||||
trust_proxy: false
|
trust_proxy: false
|
||||||
auto_join:
|
auto_join:
|
||||||
- "!your_room_id:your.server"
|
- "!your_room_id:your.server"
|
||||||
|
legal:
|
||||||
|
- title: "Terms of Service"
|
||||||
|
url: "https://matrix.your.server/_matrix/consent"
|
||||||
|
|
|
@ -24,6 +24,16 @@
|
||||||
<p class="help">
|
<p class="help">
|
||||||
Sending this form will create a Matrix account for you and reserve your username. However, you will not be able to log in until an administrator approves your registration. Please provide a reason for your registration to help us expedite the approval process.
|
Sending this form will create a Matrix account for you and reserve your username. However, you will not be able to log in until an administrator approves your registration. Please provide a reason for your registration to help us expedite the approval process.
|
||||||
</p>
|
</p>
|
||||||
|
{% if legal_links %}
|
||||||
|
<p class="help">
|
||||||
|
By completing this registration, you agree to the following:
|
||||||
|
<ul>
|
||||||
|
{% for link in legal_links %}
|
||||||
|
<li><a href="{{ link.url }}">{{ link.title }}</a></li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</p>
|
||||||
|
{% endif %}
|
||||||
<button type="submit" class="button is-link">Complete Registration</button>
|
<button type="submit" class="button is-link">Complete Registration</button>
|
||||||
</form>
|
</form>
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
|
|
@ -16,6 +16,14 @@
|
||||||
<p class="help">
|
<p class="help">
|
||||||
By clicking the button below, you agree that we store your email address and the IP address of the device you are using to send this request for processing your registration.
|
By clicking the button below, you agree that we store your email address and the IP address of the device you are using to send this request for processing your registration.
|
||||||
</p>
|
</p>
|
||||||
|
{% if legal_links %}
|
||||||
|
<p class="help">
|
||||||
|
You also confirm that you have read and agree to the following documents, which govern the use of our Matrix server:
|
||||||
|
{% for link in legal_links %}
|
||||||
|
<a href="{{ link.url }}">{{ link.title }}</a>{% if not forloop.last %}, {% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</p>
|
||||||
|
{% endif %}
|
||||||
<button type="submit" class="button is-link">Verify Email</button>
|
<button type="submit" class="button is-link">Verify Email</button>
|
||||||
</form>
|
</form>
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
|
|
@ -45,6 +45,11 @@ class EmailInputView(FormView):
|
||||||
template_name = "registration/email_form.html"
|
template_name = "registration/email_form.html"
|
||||||
form_class = EmailForm
|
form_class = EmailForm
|
||||||
|
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
context = super().get_context_data(**kwargs)
|
||||||
|
context["legal_links"] = settings.LEGAL_LINKS
|
||||||
|
return context
|
||||||
|
|
||||||
def form_valid(self, form):
|
def form_valid(self, form):
|
||||||
email = form.cleaned_data["email"]
|
email = form.cleaned_data["email"]
|
||||||
|
|
||||||
|
@ -114,6 +119,11 @@ class CompleteRegistrationView(FormView):
|
||||||
form_class = RegistrationForm
|
form_class = RegistrationForm
|
||||||
success_url = reverse_lazy("registration_complete")
|
success_url = reverse_lazy("registration_complete")
|
||||||
|
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
context = super().get_context_data(**kwargs)
|
||||||
|
context["legal_links"] = settings.LEGAL_LINKS
|
||||||
|
return context
|
||||||
|
|
||||||
def form_valid(self, form):
|
def form_valid(self, form):
|
||||||
password = form.cleaned_data["password1"]
|
password = form.cleaned_data["password1"]
|
||||||
registration_reason = form.cleaned_data["registration_reason"]
|
registration_reason = form.cleaned_data["registration_reason"]
|
||||||
|
|
|
@ -54,6 +54,7 @@ if not ALLOWED_HOSTS:
|
||||||
|
|
||||||
CSRF_TRUSTED_ORIGINS = [f"https://{host}" for host in ALLOWED_HOSTS]
|
CSRF_TRUSTED_ORIGINS = [f"https://{host}" for host in ALLOWED_HOSTS]
|
||||||
|
|
||||||
|
LEGAL_LINKS = config.get("legal", [])
|
||||||
|
|
||||||
# Synapse configuration
|
# Synapse configuration
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue