From 28eaf5620e94207cbf56495df3d865b7188dab4e Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Wed, 27 Sep 2017 16:44:15 -0700 Subject: [PATCH] emails: Use common_context for email change notifications. This also lets us remove `realm_uri`. --- templates/zerver/emails/confirm_new_email.source.html | 2 +- templates/zerver/emails/confirm_new_email.txt | 2 +- zerver/lib/actions.py | 9 +++++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/templates/zerver/emails/confirm_new_email.source.html b/templates/zerver/emails/confirm_new_email.source.html index d47cdbc319..57ab3da3f7 100644 --- a/templates/zerver/emails/confirm_new_email.source.html +++ b/templates/zerver/emails/confirm_new_email.source.html @@ -10,7 +10,7 @@

We received a request to change the email address for the Zulip - account on {{ realm.uri }} from {{ old_email }} to {{ new_email }}. + account on {{ realm_uri }} from {{ old_email }} to {{ new_email }}. If you would like to confirm this change, please click here: Confirm email change

diff --git a/templates/zerver/emails/confirm_new_email.txt b/templates/zerver/emails/confirm_new_email.txt index 9a9ba05f15..f74666ac0b 100644 --- a/templates/zerver/emails/confirm_new_email.txt +++ b/templates/zerver/emails/confirm_new_email.txt @@ -1,7 +1,7 @@ Hi! We received a request to change the email address for the Zulip account on -{{ realm.uri }} from {{ old_email }} to {{ new_email }}. If you would like +{{ realm_uri }} from {{ old_email }} to {{ new_email }}. If you would like to confirm this change, please click this link: {{ activate_url }} diff --git a/zerver/lib/actions.py b/zerver/lib/actions.py index c324333c29..57f00f140e 100644 --- a/zerver/lib/actions.py +++ b/zerver/lib/actions.py @@ -649,8 +649,13 @@ def do_start_email_change_process(user_profile, new_email): user_profile=user_profile, realm=user_profile.realm) activation_url = create_confirmation_link(obj, user_profile.realm.host, Confirmation.EMAIL_CHANGE) - context = {'realm': user_profile.realm, 'old_email': old_email, 'new_email': new_email, - 'activate_url': activation_url} + from zerver.context_processors import common_context + context = common_context(user_profile) + context.update({ + 'old_email': old_email, + 'new_email': new_email, + 'activate_url': activation_url + }) send_email('zerver/emails/confirm_new_email', to_email=new_email, from_name='Zulip Account Security', from_address=FromAddress.NOREPLY, context=context)