emails: Confirmation emails should come from the NOREPLY address.

This prevents users from accidentally sending a confirmation link
specific to their account to their Zulip administrator if they reply
to the invitation, invitation reminder, account confirmation, or new
email confirmation emails.
This commit is contained in:
James Rowan 2017-07-05 13:02:02 -04:00 committed by Tim Abbott
parent df4b306c20
commit 0951666cbb
3 changed files with 4 additions and 4 deletions

View File

@ -640,7 +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) 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, context = {'realm': user_profile.realm, 'old_email': old_email, 'new_email': new_email,
'activate_url': activation_url} 'activate_url': activation_url}
send_email('zerver/emails/confirm_new_email', new_email, from_address=FromAddress.SUPPORT, context=context) send_email('zerver/emails/confirm_new_email', new_email, from_address=FromAddress.NOREPLY, context=context)
def compute_irc_user_fullname(email): def compute_irc_user_fullname(email):
# type: (NonBinaryStr) -> NonBinaryStr # type: (NonBinaryStr) -> NonBinaryStr
@ -3053,7 +3053,7 @@ def do_send_confirmation_email(invitee, referrer, body):
""" """
activation_url = Confirmation.objects.get_link_for_object(invitee, host=referrer.realm.host) activation_url = Confirmation.objects.get_link_for_object(invitee, host=referrer.realm.host)
context = {'referrer': referrer, 'custom_body': body, 'activate_url': activation_url} context = {'referrer': referrer, 'custom_body': body, 'activate_url': activation_url}
send_email('zerver/emails/invitation', invitee.email, from_address=FromAddress.SUPPORT, context=context) send_email('zerver/emails/invitation', invitee.email, from_address=FromAddress.NOREPLY, context=context)
def is_inactive(email): def is_inactive(email):
# type: (Text) -> None # type: (Text) -> None

View File

@ -313,7 +313,7 @@ def send_registration_completion_email(email, request, realm_creation=False):
""" """
prereg_user = create_preregistration_user(email, request, realm_creation) prereg_user = create_preregistration_user(email, request, realm_creation)
activation_url = Confirmation.objects.get_link_for_object(prereg_user, host=request.get_host()) activation_url = Confirmation.objects.get_link_for_object(prereg_user, host=request.get_host())
send_email('zerver/emails/confirm_registration', email, from_address=FromAddress.SUPPORT, send_email('zerver/emails/confirm_registration', email, from_address=FromAddress.NOREPLY,
context={'activate_url': activation_url}) context={'activate_url': activation_url})
if settings.DEVELOPMENT and realm_creation: if settings.DEVELOPMENT and realm_creation:
request.session['confirmation_key'] = {'confirmation_key': activation_url.split('/')[-1]} request.session['confirmation_key'] = {'confirmation_key': activation_url.split('/')[-1]}

View File

@ -180,7 +180,7 @@ class ConfirmationEmailWorker(QueueProcessingWorker):
send_future_email( send_future_email(
"zerver/emails/invitation_reminder", "zerver/emails/invitation_reminder",
data["email"], data["email"],
from_address=FromAddress.SUPPORT, from_address=FromAddress.NOREPLY,
context=context, context=context,
delay=datetime.timedelta(days=2)) delay=datetime.timedelta(days=2))