From f3ad9c54fac5a9727ab211004f6afafe6531687d Mon Sep 17 00:00:00 2001
From: Kumi
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.
+ By completing this registration, you agree to the following:
+
+ {% for link in legal_links %}
+
+
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.
+ {% if legal_links %} ++ 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 %} + {{ link.title }}{% if not forloop.last %}, {% endif %} + {% endfor %} +
+ {% endif %} {% endblock content %} diff --git a/src/synapse_registration/registration/views.py b/src/synapse_registration/registration/views.py index 80c48be..21f4034 100644 --- a/src/synapse_registration/registration/views.py +++ b/src/synapse_registration/registration/views.py @@ -45,6 +45,11 @@ class EmailInputView(FormView): template_name = "registration/email_form.html" 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): email = form.cleaned_data["email"] @@ -114,6 +119,11 @@ class CompleteRegistrationView(FormView): form_class = RegistrationForm 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): password = form.cleaned_data["password1"] registration_reason = form.cleaned_data["registration_reason"] diff --git a/src/synapse_registration/synapse_registration/settings.py b/src/synapse_registration/synapse_registration/settings.py index bebf647..ddbf3ac 100644 --- a/src/synapse_registration/synapse_registration/settings.py +++ b/src/synapse_registration/synapse_registration/settings.py @@ -54,6 +54,7 @@ if not ALLOWED_HOSTS: CSRF_TRUSTED_ORIGINS = [f"https://{host}" for host in ALLOWED_HOSTS] +LEGAL_LINKS = config.get("legal", []) # Synapse configuration