|
|
|
@ -29,16 +29,11 @@ class UserNotification(object):
@@ -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):
@@ -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):
@@ -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):
@@ -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) |
|
|
|
|