emails: Use common_context for email change notifications.

This also lets us remove `realm_uri`.
This commit is contained in:
Tim Abbott 2017-09-27 16:44:15 -07:00
parent d0a9e92f1d
commit 28eaf5620e
3 changed files with 9 additions and 4 deletions

View File

@ -10,7 +10,7 @@
<p>
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:
<a class="button" href="{{ activate_url }}">Confirm email change</a>
</p>

View File

@ -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 }}

View File

@ -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)