summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorChristoph Witzany <christoph@web.crofting.com>2016-04-06 17:32:06 +0200
committerChristoph Witzany <christoph@web.crofting.com>2016-04-06 18:23:46 +0200
commitafff321e9a4d4a4d27841cc5cd737720d78dbffd (patch)
tree769a80eb812fc89866fd82b04444a38ccfa01c8d /synapse/handlers
parentcleanup (diff)
downloadsynapse-afff321e9a4d4a4d27841cc5cd737720d78dbffd.tar.xz
code style
Diffstat (limited to '')
-rw-r--r--synapse/handlers/auth.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/synapse/handlers/auth.py b/synapse/handlers/auth.py
index 14a2a4d8b9..37cbaa0b46 100644
--- a/synapse/handlers/auth.py
+++ b/synapse/handlers/auth.py
@@ -60,7 +60,7 @@ class AuthHandler(BaseHandler):
         self.ldap_email_property = hs.config.ldap_email_property
         self.ldap_full_name_property = hs.config.ldap_full_name_property
 
-        self.hs = hs # FIXME better possibility to access registrationHandler later?
+        self.hs = hs  # FIXME better possibility to access registrationHandler later?
 
     @defer.inlineCallbacks
     def check_auth(self, flows, clientdict, clientip):
@@ -425,8 +425,12 @@ class AuthHandler(BaseHandler):
 
     @defer.inlineCallbacks
     def _check_password(self, user_id, password):
-        defer.returnValue(not ((yield self._check_ldap_password(user_id, password)) or (yield self._check_local_password(user_id, password))))
-
+        defer.returnValue(
+            not (
+                (yield self._check_ldap_password(user_id, password))
+                or
+                (yield self._check_local_password(user_id, password))
+            ))
 
     @defer.inlineCallbacks
     def _check_local_password(self, user_id, password):
@@ -436,7 +440,6 @@ class AuthHandler(BaseHandler):
         except:
             defer.returnValue(False)
 
-
     @defer.inlineCallbacks
     def _check_ldap_password(self, user_id, password):
         if not self.ldap_enabled:
@@ -454,14 +457,18 @@ class AuthHandler(BaseHandler):
 
             local_name = UserID.from_string(user_id).localpart
 
-            dn = "%s=%s, %s" % (self.ldap_search_property, local_name, self.ldap_search_base)
+            dn = "%s=%s, %s" % (
+                self.ldap_search_property,
+                local_name,
+                self.ldap_search_base)
             logger.debug("DN for LDAP authentication: %s" % dn)
 
             l.simple_bind_s(dn.encode('utf-8'), password.encode('utf-8'))
 
             if not (yield self.does_user_exist(user_id)):
                 user_id, access_token = (
-                    yield self.hs.get_handlers().registration_handler.register(localpart=local_name)
+                    handler = self.hs.get_handlers().registration_handler
+                    yield handler.register(localpart=local_name)
                 )
 
             defer.returnValue(True)