mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-18 05:34:21 -05:00
Fix check_password rather than inverting the meaning of _check_local_password (#730)
This commit is contained in:
parent
a4c56bf67b
commit
3c79bdd7a0
@ -428,8 +428,11 @@ class AuthHandler(BaseHandler):
|
|||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def _check_password(self, user_id, password):
|
def _check_password(self, user_id, password):
|
||||||
defer.returnValue(
|
"""
|
||||||
not (
|
Returns:
|
||||||
|
True if the user_id successfully authenticated
|
||||||
|
"""
|
||||||
|
defer.returnValue((
|
||||||
(yield self._check_ldap_password(user_id, password))
|
(yield self._check_ldap_password(user_id, password))
|
||||||
or
|
or
|
||||||
(yield self._check_local_password(user_id, password))
|
(yield self._check_local_password(user_id, password))
|
||||||
@ -439,13 +442,13 @@ class AuthHandler(BaseHandler):
|
|||||||
def _check_local_password(self, user_id, password):
|
def _check_local_password(self, user_id, password):
|
||||||
try:
|
try:
|
||||||
user_id, password_hash = yield self._find_user_id_and_pwd_hash(user_id)
|
user_id, password_hash = yield self._find_user_id_and_pwd_hash(user_id)
|
||||||
defer.returnValue(not self.validate_hash(password, password_hash))
|
defer.returnValue(self.validate_hash(password, password_hash))
|
||||||
except LoginError:
|
except LoginError:
|
||||||
defer.returnValue(True)
|
defer.returnValue(False)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def _check_ldap_password(self, user_id, password):
|
def _check_ldap_password(self, user_id, password):
|
||||||
if self.ldap_enabled is not True:
|
if not self.ldap_enabled:
|
||||||
logger.debug("LDAP not configured")
|
logger.debug("LDAP not configured")
|
||||||
defer.returnValue(False)
|
defer.returnValue(False)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user