diff options
author | David Baker <dave@matrix.org> | 2017-01-18 13:25:56 +0000 |
---|---|---|
committer | David Baker <dave@matrix.org> | 2017-01-18 13:25:56 +0000 |
commit | 8c5009b6282b10b2248f080cd9021a799aad5285 (patch) | |
tree | 62adc590647489cca71e77e6f6fe4088b4664dca /synapse/rest/client/v1/login.py | |
parent | Merge pull request #1823 from matrix-org/erikj/load_events_logs (diff) | |
download | synapse-8c5009b6282b10b2248f080cd9021a799aad5285.tar.xz |
Lowercase all email addresses before querying db
Since we store all emails in the DB in lowercase (https://github.com/matrix-org/synapse/pull/1170)
Diffstat (limited to 'synapse/rest/client/v1/login.py')
-rw-r--r-- | synapse/rest/client/v1/login.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/synapse/rest/client/v1/login.py b/synapse/rest/client/v1/login.py index 093bc072f4..0c9cdff3b8 100644 --- a/synapse/rest/client/v1/login.py +++ b/synapse/rest/client/v1/login.py @@ -118,8 +118,14 @@ class LoginRestServlet(ClientV1RestServlet): @defer.inlineCallbacks def do_password_login(self, login_submission): if 'medium' in login_submission and 'address' in login_submission: + address = login_submission['address'] + if login_submission['medium'] == 'email': + # For emails, transform the address to lowercase. + # We store all email addreses as lowercase in the DB. + # (See add_threepid in synapse/handlers/auth.py) + address = address.lower() user_id = yield self.hs.get_datastore().get_user_id_by_threepid( - login_submission['medium'], login_submission['address'] + login_submission['medium'], address ) if not user_id: raise LoginError(403, "", errcode=Codes.FORBIDDEN) |