code style
This commit is contained in:
parent
8f0e47fae8
commit
afff321e9a
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue