mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +00:00
emails: Add a FromAddress class to control access to certain settings emails.
No change in behavior. Also makes the first step towards converting all uses of settings.ZULIP_ADMINISTRATOR and settings.NOREPLY_EMAIL_ADDRESS to FromAddress.*. Once everything is converted, it will be easier to ensure that future development doesn't break backwards compatibility with the old style of settings emails.
This commit is contained in:
@@ -29,7 +29,7 @@ from zerver.lib.message import (
|
||||
)
|
||||
from zerver.lib.realm_icon import realm_icon_url
|
||||
from zerver.lib.retention import move_message_to_archive
|
||||
from zerver.lib.send_email import send_email
|
||||
from zerver.lib.send_email import send_email, FromAddress
|
||||
from zerver.models import Realm, RealmEmoji, Stream, UserProfile, UserActivity, \
|
||||
RealmDomain, \
|
||||
Subscription, Recipient, Message, Attachment, UserMessage, RealmAuditLog, \
|
||||
@@ -640,8 +640,7 @@ def do_start_email_change_process(user_profile, new_email):
|
||||
activation_url = EmailChangeConfirmation.objects.get_link_for_object(obj, host=user_profile.realm.host)
|
||||
context = {'realm': user_profile.realm, 'old_email': old_email, 'new_email': new_email,
|
||||
'activate_url': activation_url}
|
||||
send_email('zerver/emails/confirm_new_email', new_email, from_address=settings.ZULIP_ADMINISTRATOR.split()[-1],
|
||||
context=context)
|
||||
send_email('zerver/emails/confirm_new_email', new_email, from_address=FromAddress.SUPPORT, context=context)
|
||||
|
||||
def compute_irc_user_fullname(email):
|
||||
# type: (NonBinaryStr) -> NonBinaryStr
|
||||
@@ -3054,8 +3053,7 @@ def do_send_confirmation_email(invitee, referrer, body):
|
||||
"""
|
||||
activation_url = Confirmation.objects.get_link_for_object(invitee, host=referrer.realm.host)
|
||||
context = {'referrer': referrer, 'custom_body': body, 'activate_url': activation_url}
|
||||
send_email('zerver/emails/invitation', invitee.email, from_address=settings.ZULIP_ADMINISTRATOR.split()[-1],
|
||||
context=context)
|
||||
send_email('zerver/emails/invitation', invitee.email, from_address=FromAddress.SUPPORT, context=context)
|
||||
|
||||
def is_inactive(email):
|
||||
# type: (Text) -> None
|
||||
|
||||
Reference in New Issue
Block a user