diff --git a/templates/zerver/emails/notify_change_in_email.html b/templates/zerver/emails/notify_change_in_email.html new file mode 100644 index 0000000000..b1114c25c0 --- /dev/null +++ b/templates/zerver/emails/notify_change_in_email.html @@ -0,0 +1,12 @@ +{% extends "zerver/emails/email_base.html" %} + +{% block content %} +

Hi,

+

+ We just wanted to let you know that the email associated with your Zulip account was recently changed to {{ new_email }}. If you did not request this change, please contact us immediately at {{ support_email }}. +

+

+ Best,
+ The Zulip Team +

+{% endblock %} diff --git a/templates/zerver/emails/password_reset.html b/templates/zerver/emails/password_reset.html new file mode 100644 index 0000000000..a9e9816c5a --- /dev/null +++ b/templates/zerver/emails/password_reset.html @@ -0,0 +1,17 @@ +{% extends "zerver/emails/email_base.html" %} + +{% block content %} +

+ {% if attempted_realm %} + Someone (possibly you) requested a password reset email for {{ email }} on {{ attempted_realm.uri }}, but {{ email }} does not have an active account in {{ attempted_realm.uri }}. However, {{ email }} does have an active account in {{ user.realm.uri }} organization; you can try logging in or resetting your password there. + {% else %} + Psst. Word on the street is that you forgot your password, {{ email }}.
+ It's all good. Follow the link below and we'll take care of the rest:
+ {{ protocol }}://{{ user.realm.host }}{{ url('django.contrib.auth.views.password_reset_confirm', kwargs=dict(uidb64=uid, token=token)) }} + {% endif %} +

+

+ Thanks,
+ Your friends at Zulip HQ +

+{% endblock %} diff --git a/zerver/lib/send_email.py b/zerver/lib/send_email.py index e064fdb327..32ab00aaa6 100644 --- a/zerver/lib/send_email.py +++ b/zerver/lib/send_email.py @@ -1,6 +1,6 @@ from django.conf import settings from django.core.mail import EmailMultiAlternatives -from django.template import loader, TemplateDoesNotExist +from django.template import loader from django.utils.timezone import now as timezone_now from zerver.models import UserProfile, ScheduledJob @@ -27,11 +27,7 @@ def build_email(template_prefix, to_email, from_email=None, reply_to_email=None, context=context, using='Jinja2_plaintext').strip() message = loader.render_to_string(template_prefix + '.txt', context=context, using='Jinja2_plaintext') - # Remove try/expect once https://github.com/zulip/zulip/issues/4691 is resolved. - try: - html_message = loader.render_to_string(template_prefix + '.html', context) - except TemplateDoesNotExist: - html_message = None + html_message = loader.render_to_string(template_prefix + '.html', context) if from_email is None: from_email = settings.NOREPLY_EMAIL_ADDRESS reply_to = None diff --git a/zerver/tests/test_templates.py b/zerver/tests/test_templates.py index 26a95844ef..33d346d556 100644 --- a/zerver/tests/test_templates.py +++ b/zerver/tests/test_templates.py @@ -90,6 +90,7 @@ class TemplateTestCase(ZulipTestCase): 'zerver/emails/confirm_new_email.html', 'zerver/emails/confirm_new_email.txt', 'zerver/emails/notify_change_in_email.subject', + 'zerver/emails/notify_change_in_email.html', 'zerver/emails/digest.subject', 'zerver/emails/digest.html', 'zerver/emails/digest.txt', @@ -99,6 +100,7 @@ class TemplateTestCase(ZulipTestCase): 'zerver/emails/followup_day2.subject', 'zerver/emails/followup_day2.txt', 'zerver/emails/followup_day2.html', + 'zerver/emails/password_reset.html', 'corporate/mit.html', 'corporate/zephyr.html', 'corporate/zephyr-mirror.html',