summaryrefslogtreecommitdiff
path: root/mail
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2015-09-24 11:48:04 +0200
committerRuben Pollan <meskio@sindominio.net>2015-09-24 11:48:04 +0200
commit908af7780aafa933faebdb72fdd2f87ac1775ce0 (patch)
treebcbb9c977cf32d8b588b3190c36e6ccd8493c0c4 /mail
parent6852b6df432ecd6ea08ecbd0c48385e94b16d2de (diff)
[bug] signal expired auth token to the GUI
In case of InvalidAuthTokeError from soledad sync we need signal the GUI, so it will request her to log in again. - Resolves: #7430
Diffstat (limited to 'mail')
-rw-r--r--mail/changes/bug-7430_signal_InvalidAuthTokenError1
-rw-r--r--mail/src/leap/mail/incoming/service.py16
2 files changed, 9 insertions, 8 deletions
diff --git a/mail/changes/bug-7430_signal_InvalidAuthTokenError b/mail/changes/bug-7430_signal_InvalidAuthTokenError
new file mode 100644
index 0000000..cf805ba
--- /dev/null
+++ b/mail/changes/bug-7430_signal_InvalidAuthTokenError
@@ -0,0 +1 @@
+- If the auth token has expired signal the GUI to request her to log in again (Closes: #7430)
diff --git a/mail/src/leap/mail/incoming/service.py b/mail/src/leap/mail/incoming/service.py
index d554c51..d8b91ba 100644
--- a/mail/src/leap/mail/incoming/service.py
+++ b/mail/src/leap/mail/incoming/service.py
@@ -228,18 +228,18 @@ class IncomingMail(Service):
def _log_synced(result):
log.msg('FETCH soledad SYNCED.')
return result
- try:
- log.msg('FETCH: syncing soledad...')
- d = self._soledad.sync()
- d.addCallback(_log_synced)
- return d
- # TODO is this still raised? or should we do failure.trap
- # instead?
- except InvalidAuthTokenError:
+
+ def _signal_invalid_auth(failure):
+ failure.trap(InvalidAuthTokenError)
# if the token is invalid, send an event so the GUI can
# disable mail and show an error message.
emit_async(catalog.SOLEDAD_INVALID_AUTH_TOKEN)
+ log.msg('FETCH: syncing soledad...')
+ d = self._soledad.sync()
+ d.addCallbacks(_log_synced, _signal_invalid_auth)
+ return d
+
def _signal_fetch_to_ui(self, doclist):
"""
Send leap events to ui.