diff options
| author | J08nY | 2017-07-06 20:01:54 +0200 |
|---|---|---|
| committer | J08nY | 2017-08-30 13:18:40 +0200 |
| commit | 6b6818b65816c86c1b5dc8d68a64a530f8e8b321 (patch) | |
| tree | 8eeaeb9210138e0c5820bf1530159a09b7f18d07 /src/mailman/workflows/common.py | |
| parent | ad00a2c4147a9dff633ac095a91ad31006cfc093 (diff) | |
| download | mailman-6b6818b65816c86c1b5dc8d68a64a530f8e8b321.tar.gz mailman-6b6818b65816c86c1b5dc8d68a64a530f8e8b321.tar.zst mailman-6b6818b65816c86c1b5dc8d68a64a530f8e8b321.zip | |
Diffstat (limited to 'src/mailman/workflows/common.py')
| -rw-r--r-- | src/mailman/workflows/common.py | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/src/mailman/workflows/common.py b/src/mailman/workflows/common.py index 8593d0997..41733f6e5 100644 --- a/src/mailman/workflows/common.py +++ b/src/mailman/workflows/common.py @@ -33,9 +33,8 @@ from mailman.interfaces.member import (AlreadySubscribedError, MemberRole, MembershipIsBannedError, NotAMemberError) from mailman.interfaces.pending import IPendable, IPendings -from mailman.interfaces.subscriptions import ( - SubscriptionConfirmationNeededEvent, SubscriptionPendingError, TokenOwner, - UnsubscriptionConfirmationNeededEvent) +from mailman.interfaces.subscriptions import (SubscriptionPendingError, + TokenOwner) from mailman.interfaces.template import ITemplateLoader from mailman.interfaces.user import IUser from mailman.interfaces.usermanager import IUserManager @@ -45,7 +44,6 @@ from mailman.utilities.datetime import now from mailman.utilities.string import expand, wrap from mailman.workflows.base import Workflow from zope.component import getUtility -from zope.event import notify from zope.interface import implementer from zope.interface.exceptions import DoesNotImplement @@ -266,13 +264,28 @@ class RequestMixin: self.push('do_confirm_verify') self.save() if self._workflow is WhichWorkflow.subscription: - event_class = SubscriptionConfirmationNeededEvent + template_name = 'list:user:action:subscribe' else: - event_class = UnsubscriptionConfirmationNeededEvent + template_name = 'list:user:action:unsubscribe' - # Triggering this event causes the confirmation message to be sent. - notify(event_class( - self.mlist, self.token, self.address.email)) + subject = 'confirm {}'.format(self.token) + confirm_address = self.mlist.confirm_address(self.token) + email_address = self.address.email + # Send a verification email to the address. + template = getUtility(ITemplateLoader).get(template_name, self.mlist) + text = expand(template, self.mlist, dict( + token=self.token, + subject=subject, + confirm_email=confirm_address, + user_email=email_address, + # For backward compatibility. + confirm_address=confirm_address, + email_address=email_address, + domain_name=self.mlist.domain.mail_host, + contact_address=self.mlist.owner_address, + )) + msg = UserNotification(email_address, confirm_address, subject, text) + msg.send(self.mlist, add_precedence=False) # Now we wait for the confirmation. raise StopIteration |
