~roadmr/canonical-identity-provider/update-raven

« back to all changes in this revision

Viewing changes to src/identityprovider/emailutils.py

  • Committer: Ubuntu One Auto Copilot
  • Author(s): Daniel Manrique
  • Date: 2018-04-04 19:45:47 UTC
  • mfrom: (1613.2.5 mail-on-pwd-change)
  • Revision ID: otto-copilot@canonical.com-20180404194547-r9pt5v0xkijs3clz
Send e-mail when user changes their password.

This is controlled by a gargoyle switch in case it misbehaves.

Merged from https://code.launchpad.net/~roadmr/canonical-identity-provider/mail-on-pwd-change/+merge/342474

Show diffs side-by-side

added added

removed removed

Lines of Context:
219
219
    return token, invalidate_email_token
220
220
 
221
221
 
 
222
def send_password_change_email(account):
 
223
    email = account.preferredemail
 
224
    if email is None:
 
225
        logger.warning(
 
226
            'Unable to find a suitable email address to send '
 
227
            'password change notification for account %s', account)
 
228
        return
 
229
    context = {
 
230
        'display_name': account.displayname
 
231
    }
 
232
    send_fancy_email(
 
233
        _("Password change notification"),
 
234
        'email/password-changed.txt',
 
235
        context=context, email=email.email)
 
236
 
 
237
 
222
238
def send_printed_codes_renewal_email(root_url, account, devices):
223
239
    email = account.preferredemail
224
240
    if email is None: