diff --git a/corporate/tests/test_remote_billing.py b/corporate/tests/test_remote_billing.py index 2b1bb16db9..9e6010afa4 100644 --- a/corporate/tests/test_remote_billing.py +++ b/corporate/tests/test_remote_billing.py @@ -88,7 +88,7 @@ class RemoteBillingAuthenticationTest(BouncerTestCase): f"{settings.SELF_HOSTING_MANAGEMENT_SUBDOMAIN}.{settings.EXTERNAL_HOST}" r"(\S+)" ), - email_body_contains="This link will expire in 2 hours", + email_body_contains="This link will expire in 24 hours", ) if return_without_clicking_confirmation_link: return result @@ -514,7 +514,7 @@ class LegacyServerLoginTest(BouncerTestCase): url_pattern=( f"{settings.SELF_HOSTING_MANAGEMENT_SUBDOMAIN}.{settings.EXTERNAL_HOST}" + r"(\S+)" ), - email_body_contains="This link will expire in 2 hours", + email_body_contains="This link will expire in 24 hours", ) if return_without_clicking_confirmation_link: return result diff --git a/corporate/views/remote_billing_page.py b/corporate/views/remote_billing_page.py index 705e9f148f..4a78cd90e2 100644 --- a/corporate/views/remote_billing_page.py +++ b/corporate/views/remote_billing_page.py @@ -58,6 +58,9 @@ VALID_NEXT_PAGES = [None, "sponsorship", "upgrade", "billing", "plans"] VALID_NEXT_PAGES_TYPE = Literal[None, "sponsorship", "upgrade", "billing", "plans"] REMOTE_BILLING_SIGNED_ACCESS_TOKEN_VALIDITY_IN_SECONDS = 2 * 60 * 60 +# We use units of hours here so that we can pass this through to the +# email template that tells the recipient how long these will last. +LOGIN_CONFIRMATION_EMAIL_DURATION_HOURS = 24 @csrf_exempt @@ -308,9 +311,7 @@ def remote_realm_billing_confirm_email( url = create_remote_billing_confirmation_link( obj, Confirmation.REMOTE_REALM_BILLING_LEGACY_LOGIN, - # Use the same expiration time as for the signed access token, - # since this is similarly transient in nature. - validity_in_minutes=int(REMOTE_BILLING_SIGNED_ACCESS_TOKEN_VALIDITY_IN_SECONDS / 60), + validity_in_minutes=LOGIN_CONFIRMATION_EMAIL_DURATION_HOURS * 60, ) context = { @@ -318,6 +319,7 @@ def remote_realm_billing_confirm_email( "confirmation_url": url, "billing_help_link": "https://zulip.com/help/self-hosted-billing", "billing_contact_email": "sales@zulip.com", + "validity_in_hours": LOGIN_CONFIRMATION_EMAIL_DURATION_HOURS, } send_email( "zerver/emails/remote_realm_billing_confirm_login", @@ -522,9 +524,7 @@ def remote_billing_legacy_server_confirm_login( url = create_remote_billing_confirmation_link( obj, Confirmation.REMOTE_SERVER_BILLING_LEGACY_LOGIN, - # Use the same expiration time as for the signed access token, - # since this is similarly transient in nature. - validity_in_minutes=int(REMOTE_BILLING_SIGNED_ACCESS_TOKEN_VALIDITY_IN_SECONDS / 60), + validity_in_minutes=LOGIN_CONFIRMATION_EMAIL_DURATION_HOURS * 60, ) context = { @@ -532,6 +532,7 @@ def remote_billing_legacy_server_confirm_login( "confirmation_url": url, "billing_help_link": "https://zulip.com/help/self-hosted-billing", "billing_contact_email": "sales@zulip.com", + "validity_in_hours": LOGIN_CONFIRMATION_EMAIL_DURATION_HOURS, } send_email( "zerver/emails/remote_billing_legacy_server_confirm_login", diff --git a/templates/zerver/emails/remote_billing_legacy_server_confirm_login.html b/templates/zerver/emails/remote_billing_legacy_server_confirm_login.html index 003728a4b5..85edd743bc 100644 --- a/templates/zerver/emails/remote_billing_legacy_server_confirm_login.html +++ b/templates/zerver/emails/remote_billing_legacy_server_confirm_login.html @@ -9,7 +9,13 @@ {% trans %}Either you, or someone on your behalf, has requested a log in link to manage the Zulip plan for {{ remote_server_hostname }}.{% endtrans %}
- {{ _("Click the button below to log in. This link will expire in 2 hours.") }} + {% trans %} + Click the button below to log in. + {% endtrans %} + + {% trans %} + This link will expire in {{ validity_in_hours }} hours. + {% endtrans %}
{{ _("Log in") }} diff --git a/templates/zerver/emails/remote_billing_legacy_server_confirm_login.txt b/templates/zerver/emails/remote_billing_legacy_server_confirm_login.txt index f5ec54546f..4b6a5709de 100644 --- a/templates/zerver/emails/remote_billing_legacy_server_confirm_login.txt +++ b/templates/zerver/emails/remote_billing_legacy_server_confirm_login.txt @@ -1,7 +1,7 @@ {% trans %}Either you, or someone on your behalf, has requested a log in link to manage the Zulip plan for {{ remote_server_hostname }}.{% endtrans %} -{{ _("Click the link below to log in. This link will expire in 2 hours.") }} +{% trans %}Click the link below to log in.{% endtrans %} {% trans %}This link will expire in {{ validity_in_hours }} hours.{% endtrans %} {{ _("Log in") }}: {{ confirmation_url }} diff --git a/templates/zerver/emails/remote_realm_billing_confirm_login.html b/templates/zerver/emails/remote_realm_billing_confirm_login.html index 697fdc1020..55b1cdcfdc 100644 --- a/templates/zerver/emails/remote_realm_billing_confirm_login.html +++ b/templates/zerver/emails/remote_realm_billing_confirm_login.html @@ -6,7 +6,13 @@ {% block content %}
- {% trans %}Click the button below to log in to Zulip plan management for {{ remote_realm_host }}. This link will expire in 2 hours.{% endtrans %} + {% trans %} + Click the button below to log in to Zulip plan management for {{ remote_realm_host }}. + {% endtrans %} + + {% trans %} + This link will expire in {{ validity_in_hours }} hours. + {% endtrans %}
{{ _("Log in") }} diff --git a/templates/zerver/emails/remote_realm_billing_confirm_login.txt b/templates/zerver/emails/remote_realm_billing_confirm_login.txt index dc1a6761c3..658472e590 100644 --- a/templates/zerver/emails/remote_realm_billing_confirm_login.txt +++ b/templates/zerver/emails/remote_realm_billing_confirm_login.txt @@ -1,4 +1,4 @@ -{% trans %}Click the link below to log in to Zulip plan management for {{ remote_realm_host }}. This link will expire in 2 hours.{% endtrans %} +{% trans %}Click the link below to log in to Zulip plan management for {{remote_realm_host}}.{% endtrans %} {% trans %}This link will expire in {{ validity_in_hours }} hours.{% endtrans %} {{ _("Log in") }}: {{ confirmation_url }}