From ca71e28cd661c65fa5c7fa656b93f8dc2a7c3b9b Mon Sep 17 00:00:00 2001 From: Aman Agrawal Date: Sun, 19 Dec 2021 14:24:47 +0000 Subject: [PATCH] accounts_accept_terms: Make elements looks similar to other pages. Add even vertical space between elements. --- static/styles/portico/portico_signin.css | 30 ++++++++++++++++++--- templates/zerver/accounts_accept_terms.html | 13 ++++++--- zerver/context_processors.py | 1 + zerver/tests/test_home.py | 2 +- zproject/default_settings.py | 10 ++++++- zproject/dev_settings.py | 1 + 6 files changed, 48 insertions(+), 9 deletions(-) diff --git a/static/styles/portico/portico_signin.css b/static/styles/portico/portico_signin.css index 00164ed458..fff0e874dc 100644 --- a/static/styles/portico/portico_signin.css +++ b/static/styles/portico/portico_signin.css @@ -284,9 +284,33 @@ html { } } -.account-accept-terms-page .terms-of-service .input-group { - width: 450px; - margin: 0 auto 10px; +.account-accept-terms-page { + #registration, + #accept_tos_button { + margin: 0; + } + + .fakecontrol { + font-weight: normal; + } + + .description { + margin-bottom: 20px; + font-size: 16px; + font-weight: 400; + } + + .center-block { + max-width: 800px; + + .control-group { + margin-bottom: 5px; + } + } + + #accept_tos_button { + margin-top: 20px; + } } .register-account { diff --git a/templates/zerver/accounts_accept_terms.html b/templates/zerver/accounts_accept_terms.html index ad4ee16699..ec6b5a035d 100644 --- a/templates/zerver/accounts_accept_terms.html +++ b/templates/zerver/accounts_accept_terms.html @@ -13,7 +13,7 @@ the registration flow has its own (nearly identical) copy of the fields below in {% include special_message_template %} {% else %}
-

{{ _("Accept the new Terms of Service") }}…

+

{{ _("Accept the Terms of Service") }}

{% endif %} @@ -27,7 +27,13 @@ the registration flow has its own (nearly identical) copy of the fields below in -
+ {% if terms_of_service_message %} +
+

{{ terms_of_service_message |safe }}

+
+ {% endif %} + +
{# This is somewhat subtle. Checkboxes have a name and value, and when the checkbox is ticked, the form posts @@ -48,10 +54,9 @@ the registration flow has its own (nearly identical) copy of the fields below in {% endfor %} {% endif %}
-
-
+
diff --git a/zerver/context_processors.py b/zerver/context_processors.py index 3e0278e4ae..1ca8702cd9 100644 --- a/zerver/context_processors.py +++ b/zerver/context_processors.py @@ -176,6 +176,7 @@ def zulip_default_context(request: HttpRequest) -> Dict[str, Any]: "platform": RequestNotes.get_notes(request).client_name, "allow_search_engine_indexing": allow_search_engine_indexing, "landing_page_navbar_message": settings.LANDING_PAGE_NAVBAR_MESSAGE, + "terms_of_service_message": settings.TERMS_OF_SERVICE_MESSAGE, "is_isolated_page": is_isolated_page(request), "default_page_params": default_page_params, } diff --git a/zerver/tests/test_home.py b/zerver/tests/test_home.py index 8a0e252f49..5ebe1df2aa 100644 --- a/zerver/tests/test_home.py +++ b/zerver/tests/test_home.py @@ -462,7 +462,7 @@ class HomeTest(ZulipTestCase): result = self.client_get("/", dict(stream="Denmark")) html = result.content.decode() - self.assertIn("Accept the new Terms of Service", html) + self.assertIn("Accept the Terms of Service", html) def test_banned_desktop_app_versions(self) -> None: user = self.example_user("hamlet") diff --git a/zproject/default_settings.py b/zproject/default_settings.py index c9d3dbd1b2..edc17ea73a 100644 --- a/zproject/default_settings.py +++ b/zproject/default_settings.py @@ -355,8 +355,16 @@ REALM_CREATION_LINK_VALIDITY_DAYS = 7 # user to click through to re-accept terms of service before using # Zulip again on the web. TERMS_OF_SERVICE_VERSION: Optional[str] = None -# Template to use when bumping TERMS_OF_SERVICE_VERSION to explain situation. +# HTML template path (e.g. "corporate/zulipchat_migration_tos.html") +# displayed to users when increasing TERMS_OF_SERVICE_VERSION when a +# user is to accept the terms of service for the first time, but +# already has an account. This primarily comes up when doing a data +# import. FIRST_TIME_TERMS_OF_SERVICE_TEMPLATE: Optional[str] = None +# Custom message (HTML allowed) to be displayed to explain why users +# need to re-accept the terms of service when a new major version is +# written. +TERMS_OF_SERVICE_MESSAGE: Optional[str] = None # Hostname used for Zulip's statsd logging integration. STATSD_HOST = "" diff --git a/zproject/dev_settings.py b/zproject/dev_settings.py index cb30e382ee..c8f2586244 100644 --- a/zproject/dev_settings.py +++ b/zproject/dev_settings.py @@ -80,6 +80,7 @@ INVITES_MIN_USER_AGE_DAYS = 0 # For development convenience, configure the ToS/Privacy Policies POLICIES_DIRECTORY = "corporate/policies" TERMS_OF_SERVICE_VERSION = "1.0" +TERMS_OF_SERVICE_MESSAGE: Optional[str] = "Description of changes to the ToS!" EMBEDDED_BOTS_ENABLED = True