summary refs log tree commit diff
path: root/synapse/rest/client/v1
diff options
context:
space:
mode:
authorDaniel Wagner-Hall <daniel@matrix.org>2015-08-20 16:25:40 +0100
committerDaniel Wagner-Hall <daniel@matrix.org>2015-08-20 16:25:40 +0100
commite8cf77fa496de10246735fa8a11020663285bdd2 (patch)
tree7dfcf1f24dd965c8d34331fc70d1b17fbb6f03ad /synapse/rest/client/v1
parent/tokenrefresh POST endpoint (diff)
parentMerge branch 'release-v0.10.0' of github.com:matrix-org/synapse into develop (diff)
downloadsynapse-e8cf77fa496de10246735fa8a11020663285bdd2.tar.xz
Merge branch 'develop' into refresh
Conflicts:
	synapse/rest/client/v1/login.py
Diffstat (limited to 'synapse/rest/client/v1')
-rw-r--r--synapse/rest/client/v1/login.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/synapse/rest/client/v1/login.py b/synapse/rest/client/v1/login.py
index b963a38618..67323a16bb 100644
--- a/synapse/rest/client/v1/login.py
+++ b/synapse/rest/client/v1/login.py
@@ -74,13 +74,20 @@ class LoginRestServlet(ClientV1RestServlet):
 
     @defer.inlineCallbacks
     def do_password_login(self, login_submission):
-        if not login_submission["user"].startswith('@'):
-            login_submission["user"] = UserID.create(
-                login_submission["user"], self.hs.hostname).to_string()
+        if 'medium' in login_submission and 'address' in login_submission:
+            user_id = yield self.hs.get_datastore().get_user_id_by_threepid(
+                login_submission['medium'], login_submission['address']
+            )
+        else:
+            user_id = login_submission['user']
+
+        if not user_id.startswith('@'):
+            user_id = UserID.create(
+                user_id, self.hs.hostname).to_string()
 
         auth_handler = self.handlers.auth_handler
         access_token, refresh_token = yield auth_handler.login_with_password(
-            user_id=login_submission["user"],
+            user_id=user_id,
             password=login_submission["password"])
 
         result = {