Add methods to send a password change notification.

This commit is contained in:
Ricky Ramirez
2013-06-18 23:17:13 -07:00
parent ce2cd86bdf
commit 14b95b843f
4 changed files with 41 additions and 1 deletions

View File

@@ -105,6 +105,14 @@ def password_email(user):
Email.Kind.RESET_PASSWORD)
return True
def password_change_email(user):
"""Queues a system email for a password change notification."""
from r2.lib.pages import PasswordChangeEmail
return _system_email(user.email,
PasswordChangeEmail(user=user).render(style='email'),
Email.Kind.PASSWORD_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,

View File

@@ -2060,6 +2060,10 @@ class PasswordReset(Templated):
entered their user name in Password.)"""
pass
class PasswordChangeEmail(Templated):
"""Notification e-mail that a user's password has changed."""
pass
class VerifyEmail(Templated):
pass

View File

@@ -301,6 +301,7 @@ class Email(object):
"NEW_PROMO",
"NERDMAIL",
"GOLDMAIL",
"PASSWORD_CHANGE",
)
subjects = {
@@ -319,7 +320,8 @@ class Email(object):
Kind.FINISHED_PROMO : _("[reddit] your promotion has finished"),
Kind.NEW_PROMO : _("[reddit] your promotion has been created"),
Kind.NERDMAIL : _("[reddit] hey, nerd!"),
Kind.GOLDMAIL : _("[reddit] reddit gold activation link")
Kind.GOLDMAIL : _("[reddit] reddit gold activation link"),
Kind.PASSWORD_CHANGE : _("[reddit] your password has been changed"),
}
def __init__(self, user, thing, email, from_name, date, ip, banned_ip,

View File

@@ -0,0 +1,26 @@
## 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 password for /u/${thing.user.name} has been changed.
If you did not change your password, please respond to this e-mail
immediately.