summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorBruno Wagner <bwagner@riseup.net>2016-09-08 16:16:42 -0300
committerBruno Wagner <bwagner@riseup.net>2016-09-08 16:16:42 -0300
commita274d4cf3628816d21bb9848f019a444119b80a5 (patch)
tree1bed52fb0e39b94d0eda4abaf9f36d26ca4d62f4 /service
parentd5d453754bb08968f0a308235074d0ec7ef78597 (diff)
Logging out a logged out user was breaking the UA
In case a user was being logged out and there's a soledad invalid auth token error, there might be an inconsistent state where the user session doesn't exist when this second logout is tried. This was breaking the login for that user until the next UA restart, I adapted the code to make logging out an user idempotent to prevent this corner case
Diffstat (limited to 'service')
-rw-r--r--service/pixelated/config/services.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/service/pixelated/config/services.py b/service/pixelated/config/services.py
index 494be703..f060c27c 100644
--- a/service/pixelated/config/services.py
+++ b/service/pixelated/config/services.py
@@ -98,9 +98,10 @@ class ServicesFactory(object):
def destroy_session(self, user_id, using_email=False):
if using_email:
- user_id = self._map_email[user_id.split('@')[0]]
+ username = user_id.split('@')[0]
+ user_id = self._map_email.get(username, None)
- if self.has_session(user_id):
+ if user_id is not None and self.has_session(user_id):
_services = self._services_by_user[user_id]
_services.close()
del self._services_by_user[user_id]