diff --git a/ordr2/events.py b/ordr2/events.py index df0a97b..a331d28 100644 --- a/ordr2/events.py +++ b/ordr2/events.py @@ -29,16 +29,11 @@ class UserNotification(object): #: template to render template = None - def __init__(self, request, account, data=None): + def __init__(self, request, account, data=None, send_to=None): self.request = request self.account = account self.data = data - - -class CompleteRegistration(UserNotification): - ''' user notification for account activation ''' - subject = '[ordr] Please verify your email address' - template = 'ordr2:templates/emails/registration.jinja2' + self.send_to = send_to or account.email class AccountActivation(UserNotification): @@ -47,10 +42,16 @@ class AccountActivation(UserNotification): template = 'ordr2:templates/emails/activation.jinja2' -class PasswordReset(UserNotification): - ''' user notification for password reset link ''' - subject = '[ordr] Password Reset' - template = 'ordr2:templates/emails/password_reset.jinja2' +class ChangedEmail(UserNotification): + ''' user notification for a changed email address ''' + subject = '[ordr] Please verify your email address' + template = 'ordr2:templates/emails/mail_change.jinja2' + + +class CompleteRegistration(UserNotification): + ''' user notification for account activation ''' + subject = '[ordr] Please verify your email address' + template = 'ordr2:templates/emails/registration.jinja2' class OrderStatusChange(UserNotification): @@ -59,6 +60,12 @@ class OrderStatusChange(UserNotification): template = 'ordr2:templates/emails/order.jinja2' +class PasswordReset(UserNotification): + ''' user notification for password reset link ''' + subject = '[ordr] Password Reset' + template = 'ordr2:templates/emails/password_reset.jinja2' + + # subsribers for events @subscriber(UserNotification) @@ -72,7 +79,7 @@ def notify_user(event): message = Message( subject=event.subject, sender=event.request.registry.settings['mail.default_sender'], - recipients=[event.account.email], + recipients=[event.send_to], html=body ) mailer = get_mailer(event.request.registry) diff --git a/ordr2/templates/account/forgot_password_email.jinja2 b/ordr2/templates/account/forgot_password_email.jinja2 index 1b43ee5..fc44c23 100644 --- a/ordr2/templates/account/forgot_password_email.jinja2 +++ b/ordr2/templates/account/forgot_password_email.jinja2 @@ -4,6 +4,9 @@ {% block content %}
To reset your password, an email has been sent to you.
Please follow the link in the email to set a new password.
diff --git a/ordr2/templates/account/forgot_password_form.jinja2 b/ordr2/templates/account/forgot_password_form.jinja2 index 5ec26b9..d678972 100644 --- a/ordr2/templates/account/forgot_password_form.jinja2 +++ b/ordr2/templates/account/forgot_password_form.jinja2 @@ -4,6 +4,9 @@ {% block content %}