diff options
author | Jefferson Stachelski <jstachel@thoughtworks.com> | 2015-10-14 19:21:44 -0300 |
---|---|---|
committer | Jefferson Stachelski <jstachel@thoughtworks.com> | 2015-10-14 19:21:44 -0300 |
commit | 96ce1b5810ed1a1a9c6072ed2ed57fdb8f44360b (patch) | |
tree | 504c335f32871d810e18297225f8619536497d63 /service/pixelated/config/leap.py | |
parent | 3863e28bf593591b1b323f8b848233b9e6a1947b (diff) |
issue #484 - Add welcome mail for new accounts
Make a logic to add the welcome mail in INBOX when the user log into
account at the first time
Diffstat (limited to 'service/pixelated/config/leap.py')
-rw-r--r-- | service/pixelated/config/leap.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/service/pixelated/config/leap.py b/service/pixelated/config/leap.py index 4dcb18f4..83b913a8 100644 --- a/service/pixelated/config/leap.py +++ b/service/pixelated/config/leap.py @@ -1,6 +1,6 @@ from __future__ import absolute_import from pixelated.config import credentials -from leap.common.events import server as events_server +from leap.common.events import server as events_server, register, catalog as events from pixelated.bitmask_libraries.config import LeapConfig from pixelated.bitmask_libraries.certs import LeapCertificate from pixelated.bitmask_libraries.provider import LeapProvider @@ -8,6 +8,13 @@ from pixelated.bitmask_libraries.session import LeapSessionFactory from twisted.internet import defer +_CREATE_WELCOME_MAIL = False + + +def CREATE_WELCOME_MAIL(): + return _CREATE_WELCOME_MAIL + + @defer.inlineCallbacks def initialize_leap(leap_provider_cert, leap_provider_cert_fingerprint, @@ -17,6 +24,7 @@ def initialize_leap(leap_provider_cert, initial_sync=True): init_monkeypatches() events_server.ensure_server() + check_new_account() provider, username, password = credentials.read(organization_mode, credentials_file) LeapCertificate.set_cert_and_fingerprint(leap_provider_cert, leap_provider_cert_fingerprint) @@ -33,3 +41,12 @@ def initialize_leap(leap_provider_cert, def init_monkeypatches(): import pixelated.extensions.requests_urllib3 + + +def mark_to_create_welcome_mail(_, x): + global _CREATE_WELCOME_MAIL + _CREATE_WELCOME_MAIL = True + + +def check_new_account(): + register(events.KEYMANAGER_FINISHED_KEY_GENERATION, mark_to_create_welcome_mail) |