0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-11-09 11:32:01 +01:00

code style

This commit is contained in:
Christoph Witzany 2016-04-06 17:32:06 +02:00
parent 8f0e47fae8
commit afff321e9a

View file

@ -425,8 +425,12 @@ class AuthHandler(BaseHandler):
@defer.inlineCallbacks @defer.inlineCallbacks
def _check_password(self, user_id, password): 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 @defer.inlineCallbacks
def _check_local_password(self, user_id, password): def _check_local_password(self, user_id, password):
@ -436,7 +440,6 @@ class AuthHandler(BaseHandler):
except: except:
defer.returnValue(False) defer.returnValue(False)
@defer.inlineCallbacks @defer.inlineCallbacks
def _check_ldap_password(self, user_id, password): def _check_ldap_password(self, user_id, password):
if not self.ldap_enabled: if not self.ldap_enabled:
@ -454,14 +457,18 @@ class AuthHandler(BaseHandler):
local_name = UserID.from_string(user_id).localpart 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) logger.debug("DN for LDAP authentication: %s" % dn)
l.simple_bind_s(dn.encode('utf-8'), password.encode('utf-8')) l.simple_bind_s(dn.encode('utf-8'), password.encode('utf-8'))
if not (yield self.does_user_exist(user_id)): if not (yield self.does_user_exist(user_id)):
user_id, access_token = ( 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) defer.returnValue(True)