mirror of https://github.com/zulip/zulip.git
emails: Extend expiration for login confirmation links.
This commit is contained in:
parent
eb57b4c4f7
commit
f1ffb1f56e
|
@ -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
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -9,7 +9,13 @@
|
|||
{% trans %}Either you, or someone on your behalf, has requested a log in link to manage the Zulip plan for <b>{{ remote_server_hostname }}</b>.{% endtrans %}
|
||||
</p>
|
||||
<p>
|
||||
{{ _("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 %}
|
||||
</p>
|
||||
<p>
|
||||
<a class="button" href="{{ confirmation_url }}">{{ _("Log in") }}</a>
|
||||
|
|
|
@ -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 }}
|
||||
|
||||
|
|
|
@ -6,7 +6,13 @@
|
|||
|
||||
{% block content %}
|
||||
<p>
|
||||
{% trans %}Click the button below to log in to Zulip plan management for <b>{{ remote_realm_host }}</b>. This link will expire in 2 hours.{% endtrans %}
|
||||
{% trans %}
|
||||
Click the button below to log in to Zulip plan management for <b>{{ remote_realm_host }}</b>.
|
||||
{% endtrans %}
|
||||
|
||||
{% trans %}
|
||||
This link will expire in {{ validity_in_hours }} hours.
|
||||
{% endtrans %}
|
||||
</p>
|
||||
<p>
|
||||
<a class="button" href="{{ confirmation_url }}">{{ _("Log in") }}</a>
|
||||
|
|
|
@ -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 }}
|
||||
|
|
Loading…
Reference in New Issue