summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-04-18 15:07:57 +0100
committerErik Johnston <erik@matrix.org>2016-04-18 15:07:57 +0100
commit3727a15764dece5169da299dc0abcc735c5c75ff (patch)
tree761314cef62746b08349d11a2057e8c5f3312871 /synapse
parentexplicitly pass in the charset from Content-Type to lxml to fix cyrillic woes... (diff)
parentSimplify _check_password (diff)
downloadsynapse-3727a15764dece5169da299dc0abcc735c5c75ff.tar.xz
Merge pull request #732 from matrix-org/erikj/login
Simplify _check_password
Diffstat (limited to 'synapse')
-rw-r--r--synapse/handlers/auth.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/synapse/handlers/auth.py b/synapse/handlers/auth.py
index 916632c7d7..61fe56032a 100644
--- a/synapse/handlers/auth.py
+++ b/synapse/handlers/auth.py
@@ -432,11 +432,15 @@ class AuthHandler(BaseHandler):
         Returns:
             True if the user_id successfully authenticated
         """
-        defer.returnValue((
-            (yield self._check_ldap_password(user_id, password))
-            or
-            (yield self._check_local_password(user_id, password))
-        ))
+        valid_ldap = yield self._check_ldap_password(user_id, password)
+        if valid_ldap:
+            defer.returnValue(True)
+
+        valid_local_password = yield self._check_local_password(user_id, password)
+        if valid_local_password:
+            defer.returnValue(True)
+
+        defer.returnValue(False)
 
     @defer.inlineCallbacks
     def _check_local_password(self, user_id, password):