summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTayane Fernandes <tayane.rmf@gmail.com>2017-01-11 18:06:44 -0200
committerTayane Fernandes <tayane.rmf@gmail.com>2017-01-11 18:19:53 -0200
commitd2aabc8c514cb520d968e8241ec15c93bae2a0fe (patch)
tree2b506999970dbb30c30d24a450253fc312a5e7b6
parente26490d52b7f5faafcd1b1595e07465c69ed1cc5 (diff)
Close session when UploadKeyError occurs
When the upload of the user key fails (i.e. Timeout), the session was being held in memory, preventing the user from trying again. Related with: #815, #889
-rw-r--r--service/pixelated/config/sessions.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/service/pixelated/config/sessions.py b/service/pixelated/config/sessions.py
index ec5e1c0e..73c366c7 100644
--- a/service/pixelated/config/sessions.py
+++ b/service/pixelated/config/sessions.py
@@ -19,7 +19,7 @@ from leap.common.events import (
catalog as events
)
-from pixelated.bitmask_libraries.keymanager import Keymanager
+from pixelated.bitmask_libraries.keymanager import Keymanager, UploadKeyError
from pixelated.adapter.mailstore import LeapMailStore
from pixelated.config import leap_config
from pixelated.bitmask_libraries.certs import LeapCertificate
@@ -156,7 +156,12 @@ class LeapSession(object):
@defer.inlineCallbacks
def finish_bootstrap(self):
- yield self.keymanager.generate_openpgp_key()
+ try:
+ yield self.keymanager.generate_openpgp_key()
+ except UploadKeyError as e:
+ logger.warn('{0}: {1}. Closing session for user: {2}'.format(e.__class__.__name__, e, self.account_email()))
+ self.close()
+
yield self._create_account(self.soledad, self.user_auth.uuid)
self.incoming_mail_fetcher = yield self._create_incoming_mail_fetcher(
self.keymanager,