|
@@ -16,13 +16,15 @@ class SynapseDjadhere(object):
|
|
|
def check_password(self, user_id, password):
|
|
|
localpart = user_id.split(":", 1)[0][1:]
|
|
|
|
|
|
- response = yield treq.post(
|
|
|
+ bot = user_id == self.bot_user and password == self.password
|
|
|
+
|
|
|
+ djadhere_response = yield treq.post(
|
|
|
'https://adherents.tetaneutral.net/accounts/auth_api/%s/' %
|
|
|
self.auth_api_token, {
|
|
|
'username': localpart,
|
|
|
'password': password
|
|
|
})
|
|
|
- defer.returnValue(response.code == http.OK)
|
|
|
+ defer.returnValue(bot or djadhere_response.code == http.OK)
|
|
|
|
|
|
@staticmethod
|
|
|
def parse_config(config):
|
|
@@ -32,6 +34,12 @@ class SynapseDjadhere(object):
|
|
|
conf = _DjadhereConf()
|
|
|
if 'auth_api_token' not in config:
|
|
|
raise Exception('Synapse-Djadhere needs AUTH_API_TOKEN')
|
|
|
+ if 'bot_user' not in config:
|
|
|
+ raise Exception('Synapse-Djadhere needs BOT_USER')
|
|
|
+ if 'bot_password' not in config:
|
|
|
+ raise Exception('Synapse-Djadhere needs BOT_PASSWORD')
|
|
|
conf.auth_api_token = config['auth_api_token']
|
|
|
+ conf.bot_user = config['bot_user']
|
|
|
+ conf.bot_password = config['bot_password']
|
|
|
|
|
|
return conf
|