From 96ce1b5810ed1a1a9c6072ed2ed57fdb8f44360b Mon Sep 17 00:00:00 2001 From: Jefferson Stachelski Date: Wed, 14 Oct 2015 19:21:44 -0300 Subject: 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 --- service/pixelated/config/leap.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'service/pixelated/config/leap.py') 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) -- cgit v1.2.3