Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
emails: Update help link in find team email to use external host url.
Lauryn Menard968059c7ef60
diff --git a/templates/zerver/emails/find_team.html b/templates/zerver/emails/find_team.htmlindex 9160aeff779..88f232792d7 100644--- a/templates/zerver/emails/find_team.html+++ b/templates/zerver/emails/find_team.html@@ -7,7 +7,11 @@{% block content %}<p>{{ _("Thanks for your request!") }}</p>-<p>{% trans %}Your email address {{ email }} has accounts with the following Zulip organizations hosted by <a href="{{ external_host }}">{{ external_host }}</a>:{% endtrans %}</p>+{% if corporate_enabled %}+<p>{% trans %}Your email address {{ email }} has accounts with the following Zulip Cloud organizations:{% endtrans %}</p>+{% else %}+<p>{% trans %}Your email address {{ email }} has accounts with the following Zulip organizations hosted by {{ external_host }}:{% endtrans %}</p>+{% endif %}<ul>{% for realm in realms %}@@ -16,9 +20,7 @@</ul><p>- {% trans help_url="https://zulip.com/help/change-your-password#if-youve-forgotten-or-never-had-a-password" %}- If you have trouble logging in, you can <a href="{{ help_url }}">reset your password</a>.- {% endtrans %}+ {% trans %}If you have trouble logging in, you can <a href="{{ help_reset_password_link }}">reset your password</a>.{% endtrans %}</p><p>{{ _("Thanks for using Zulip!") }}</p>diff --git a/templates/zerver/emails/find_team.txt b/templates/zerver/emails/find_team.txtindex a364cf8d48d..28af8cde868 100644--- a/templates/zerver/emails/find_team.txt+++ b/templates/zerver/emails/find_team.txt@@ -1,16 +1,18 @@{{ _("Thanks for your request!") }}-{% trans -%}-Your email address {{ email }} has accounts with the following Zulip organizations hosted by {{ external_host }}:-{%- endtrans %}+{% if corporate_enabled %}+{% trans %}Your email address {{ email }} has accounts with the following Zulip Cloud organizations:{% endtrans %}+{% else %}+{% trans %}Your email address {{ email }} has accounts with the following Zulip organizations hosted by {{ external_host }}:{% endtrans %}+{% endif %}{% for realm in realms %}* {{ realm.name }}: {{ realm.uri }}{% endfor %}-{% trans help_url="https://zulip.com/help/change-your-password#if-youve-forgotten-or-never-had-a-password" %}-If you have trouble logging in, you can reset your password ({{ help_url }}).-{% endtrans %}+{% trans %}If you have trouble logging in, you can reset your password.{% endtrans %}++{{ help_reset_password_link }}{{ _("Thanks for using Zulip!") }}diff --git a/zerver/views/registration.py b/zerver/views/registration.pyindex 436fb82b7da..eeb4d175d45 100644--- a/zerver/views/registration.py+++ b/zerver/views/registration.py@@ -1140,18 +1140,30 @@ def find_account(request: HttpRequest) -> HttpResponse:context.setdefault(key, {})context[key].setdefault("realms", [])context[key]["realms"].append(user.realm)- context[key]["external_host"] = settings.EXTERNAL_HOST# This value will end up being the last user ID among# matching accounts; since it's only used for minor# details like language, that arbitrary choice is OK.context[key]["to_user_id"] = user.id+ # Links in find_team emails use the server's information+ # and not any particular realm's information.+ external_host_base_url = f"{settings.EXTERNAL_URI_SCHEME}{settings.EXTERNAL_HOST}"+ help_base_url = f"{external_host_base_url}/help"+ help_reset_password_link = (+ f"{help_base_url}/change-your-password#if-youve-forgotten-or-never-had-a-password"+ )+for delivery_email, realm_context in context.items():- realm_context["email"] = delivery_emailsend_email("zerver/emails/find_team",to_user_ids=[realm_context["to_user_id"]],- context=realm_context,+ context={+ "external_host": settings.EXTERNAL_HOST,+ "corporate_enabled": settings.CORPORATE_ENABLED,+ "help_reset_password_link": help_reset_password_link,+ "realms": realm_context["realms"],+ "email": delivery_email,+ },from_address=FromAddress.SUPPORT,request=request,)