mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-28 16:28:01 -05:00
Send notification when a user's email is changed.
This commit is contained in:
@@ -927,6 +927,8 @@ class ApiController(RedditController, OAuth2ResourceController):
|
||||
if (not form.has_errors("email", errors.BAD_EMAILS) and
|
||||
email):
|
||||
if (not hasattr(c.user,'email') or c.user.email != email):
|
||||
if c.user.email_verified:
|
||||
emailer.email_change_email(c.user)
|
||||
c.user.email = email
|
||||
# unverified email for now
|
||||
c.user.email_verified = None
|
||||
|
||||
@@ -113,6 +113,14 @@ def password_change_email(user):
|
||||
PasswordChangeEmail(user=user).render(style='email'),
|
||||
Email.Kind.PASSWORD_CHANGE)
|
||||
|
||||
def email_change_email(user):
|
||||
"""Queues a system email for a email change notification."""
|
||||
from r2.lib.pages import EmailChangeEmail
|
||||
|
||||
return _system_email(user.email,
|
||||
EmailChangeEmail(user=user).render(style='email'),
|
||||
Email.Kind.EMAIL_CHANGE)
|
||||
|
||||
def feedback_email(email, body, name='', reply_to = ''):
|
||||
"""Queues a feedback email to the feedback account."""
|
||||
return _feedback_email(email, body, Email.Kind.FEEDBACK, name = name,
|
||||
|
||||
@@ -2064,6 +2064,10 @@ class PasswordChangeEmail(Templated):
|
||||
"""Notification e-mail that a user's password has changed."""
|
||||
pass
|
||||
|
||||
class EmailChangeEmail(Templated):
|
||||
"""Notification e-mail that a user's e-mail has changed."""
|
||||
pass
|
||||
|
||||
class VerifyEmail(Templated):
|
||||
pass
|
||||
|
||||
|
||||
@@ -302,6 +302,7 @@ class Email(object):
|
||||
"NERDMAIL",
|
||||
"GOLDMAIL",
|
||||
"PASSWORD_CHANGE",
|
||||
"EMAIL_CHANGE",
|
||||
)
|
||||
|
||||
subjects = {
|
||||
@@ -322,6 +323,7 @@ class Email(object):
|
||||
Kind.NERDMAIL : _("[reddit] hey, nerd!"),
|
||||
Kind.GOLDMAIL : _("[reddit] reddit gold activation link"),
|
||||
Kind.PASSWORD_CHANGE : _("[reddit] your password has been changed"),
|
||||
Kind.EMAIL_CHANGE : _("[reddit] your email address has been changed"),
|
||||
}
|
||||
|
||||
def __init__(self, user, thing, email, from_name, date, ip, banned_ip,
|
||||
|
||||
27
r2/r2/templates/emailchangeemail.email
Normal file
27
r2/r2/templates/emailchangeemail.email
Normal file
@@ -0,0 +1,27 @@
|
||||
## The contents of this file are subject to the Common Public Attribution
|
||||
## License Version 1.0. (the "License"); you may not use this file except in
|
||||
## compliance with the License. You may obtain a copy of the License at
|
||||
## http://code.reddit.com/LICENSE. The License is based on the Mozilla Public
|
||||
## License Version 1.1, but Sections 14 and 15 have been added to cover use of
|
||||
## software over a computer network and provide for limited attribution for the
|
||||
## Original Developer. In addition, Exhibit A has been modified to be
|
||||
## consistent with Exhibit B.
|
||||
##
|
||||
## Software distributed under the License is distributed on an "AS IS" basis,
|
||||
## WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||
## the specific language governing rights and limitations under the License.
|
||||
##
|
||||
## The Original Code is reddit.
|
||||
##
|
||||
## The Original Developer is the Initial Developer. The Initial Developer of
|
||||
## the Original Code is reddit Inc.
|
||||
##
|
||||
## All portions of the code written by reddit are Copyright (c) 2006-2013
|
||||
## reddit Inc. All Rights Reserved.
|
||||
###############################################################################
|
||||
|
||||
The e-mail address for /u/${thing.user.name} has been changed. This message is
|
||||
being sent to your old e-mail address only.
|
||||
|
||||
If you did not change your e-mail, please respond to this e-mail
|
||||
immediately.
|
||||
Reference in New Issue
Block a user