diff --git a/r2/r2/lib/emailer.py b/r2/r2/lib/emailer.py index cc3fc5342..4545d75cb 100644 --- a/r2/r2/lib/emailer.py +++ b/r2/r2/lib/emailer.py @@ -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, diff --git a/r2/r2/lib/pages/pages.py b/r2/r2/lib/pages/pages.py index b034a8f2c..054b2367a 100755 --- a/r2/r2/lib/pages/pages.py +++ b/r2/r2/lib/pages/pages.py @@ -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 diff --git a/r2/r2/models/mail_queue.py b/r2/r2/models/mail_queue.py index da9cf9c31..26abf072d 100644 --- a/r2/r2/models/mail_queue.py +++ b/r2/r2/models/mail_queue.py @@ -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, diff --git a/r2/r2/templates/passwordchangeemail.email b/r2/r2/templates/passwordchangeemail.email new file mode 100644 index 000000000..9684e14b9 --- /dev/null +++ b/r2/r2/templates/passwordchangeemail.email @@ -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.