Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

password_reset: Do not place Realm objects into context.

Alex Vandiver222729728c75
diff --git a/templates/zerver/emails/password_reset.html b/templates/zerver/emails/password_reset.html
index d071773f732..3409e938d43 100644
--- a/templates/zerver/emails/password_reset.html
+++ b/templates/zerver/emails/password_reset.html
@@ -22,11 +22,11 @@
{% endif %}
</p>
<p>
- {% if active_accounts_in_other_realms %}
+ {% if other_realm_urls %}
{{ _("You do have active accounts in the following organization(s).") }}
<ul>
- {% for active_account in active_accounts_in_other_realms %}
- <li>{{ active_account.realm.url }}</li>
+ {% for realm_url in other_realm_urls %}
+ <li>{{ realm_url }}</li>
{% endfor %}
</ul>
{% trans %}You can try logging in or resetting your password in the organization(s) above.{% endtrans %}
diff --git a/templates/zerver/emails/password_reset.txt b/templates/zerver/emails/password_reset.txt
index 29a40a05e55..6efaad68ade 100644
--- a/templates/zerver/emails/password_reset.txt
+++ b/templates/zerver/emails/password_reset.txt
@@ -17,11 +17,11 @@ You do not have an account in that Zulip organization.
{%- endtrans %}
{% endif %}
-{% if active_accounts_in_other_realms %}
+{% if other_realm_urls %}
{{ _("You do have active accounts in the following organization(s).") }}
-{% for active_account in active_accounts_in_other_realms %}
-{{ active_account.realm.url }}
+{% for realm_url in other_realm_urls %}
+{{ realm_url }}
{% endfor %}
{% trans -%}
diff --git a/zerver/actions/users.py b/zerver/actions/users.py
index df91ecd691e..da970098e90 100644
--- a/zerver/actions/users.py
+++ b/zerver/actions/users.py
@@ -976,7 +976,9 @@ def do_send_password_reset_email(
delivery_email__iexact=email, is_active=True
)
if active_accounts_in_other_realms:
- context["active_accounts_in_other_realms"] = active_accounts_in_other_realms
+ context["other_realm_urls"] = [
+ active_account.realm.url for active_account in active_accounts_in_other_realms
+ ]
language = get_language()
send_email(