summary refs log tree commit diff
path: root/synapse/handlers/auth.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-03-11 14:48:20 +0000
committerErik Johnston <erik@matrix.org>2016-03-11 14:48:20 +0000
commitb5afe6bc3853d56c4d7044a293ea1bd2d40d94a7 (patch)
treed86aee969a8881a2319db7168d8978ae4c351aba /synapse/handlers/auth.py
parentMerge pull request #640 from matrix-org/erikj/keyclient_host (diff)
parentmore pep8 (diff)
downloadsynapse-b5afe6bc3853d56c4d7044a293ea1bd2d40d94a7.tar.xz
Merge pull request #641 from matrix-org/dbkr/fix_change_password
Fix logout on password change
Diffstat (limited to 'synapse/handlers/auth.py')
-rw-r--r--synapse/handlers/auth.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/synapse/handlers/auth.py b/synapse/handlers/auth.py
index 7a4afe446d..5c0ea636bc 100644
--- a/synapse/handlers/auth.py
+++ b/synapse/handlers/auth.py
@@ -432,13 +432,18 @@ class AuthHandler(BaseHandler):
         )
 
     @defer.inlineCallbacks
-    def set_password(self, user_id, newpassword):
+    def set_password(self, user_id, newpassword, requester=None):
         password_hash = self.hash(newpassword)
 
+        except_access_token_ids = [requester.access_token_id] if requester else []
+
         yield self.store.user_set_password_hash(user_id, password_hash)
-        yield self.store.user_delete_access_tokens(user_id)
-        yield self.hs.get_pusherpool().remove_pushers_by_user(user_id)
-        yield self.store.flush_user(user_id)
+        yield self.store.user_delete_access_tokens(
+            user_id, except_access_token_ids
+        )
+        yield self.hs.get_pusherpool().remove_pushers_by_user(
+            user_id, except_access_token_ids
+        )
 
     @defer.inlineCallbacks
     def add_threepid(self, user_id, medium, address, validated_at):