summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrebs <drebs@riseup.net>2016-10-03 12:00:06 -0300
committerdrebs <drebs@riseup.net>2016-10-03 12:01:53 -0300
commit9811a6c6b723cf278d9ba141302033801f93d713 (patch)
treee7f3bf951a899ec2e80e1ed688f09d6c92e41742
parentdb4037682dcfc2b9426523640b41f59f29ec2979 (diff)
[feature] stop fetching mail on inavalid token error
-rw-r--r--src/leap/bitmask/mail/incoming/service.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/leap/bitmask/mail/incoming/service.py b/src/leap/bitmask/mail/incoming/service.py
index b18ed74..1ab6df9 100644
--- a/src/leap/bitmask/mail/incoming/service.py
+++ b/src/leap/bitmask/mail/incoming/service.py
@@ -224,16 +224,15 @@ class IncomingMail(Service):
logger.info('sync finished')
return result
- def _signal_invalid_auth(failure):
+ def _handle_invalid_auth_token_error(failure):
failure.trap(InvalidAuthTokenError)
- logger.warn('sync failed because token has expired: %r' % failure)
- # if the token is invalid, send an event so the GUI can
- # disable mail and show an error message.
+ logger.warn('sync failed because token is invalid: %r' % failure)
+ self.stopService()
emit_async(catalog.SOLEDAD_INVALID_AUTH_TOKEN, self._userid)
logger.info('starting sync...')
d = self._soledad.sync()
- d.addCallbacks(_log_synced, _signal_invalid_auth)
+ d.addCallbacks(_log_synced, _handle_invalid_auth_token_error)
return d
def _signal_fetch_to_ui(self, doclist):