mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-24 21:59:23 -05:00
Use underscores instead of camelcase for id server stuff
This commit is contained in:
parent
f7a79a37be
commit
a218619626
@ -203,19 +203,19 @@ class AuthHandler(BaseHandler):
|
|||||||
def _check_email_identity(self, authdict, _):
|
def _check_email_identity(self, authdict, _):
|
||||||
yield run_on_reactor()
|
yield run_on_reactor()
|
||||||
|
|
||||||
if 'threepidCreds' not in authdict:
|
if 'threepid_creds' not in authdict:
|
||||||
raise LoginError(400, "Missing threepidCreds", Codes.MISSING_PARAM)
|
raise LoginError(400, "Missing threepid_creds", Codes.MISSING_PARAM)
|
||||||
|
|
||||||
threepidCreds = authdict['threepidCreds']
|
threepid_creds = authdict['threepid_creds']
|
||||||
identity_handler = self.hs.get_handlers().identity_handler
|
identity_handler = self.hs.get_handlers().identity_handler
|
||||||
|
|
||||||
logger.info("Getting validated threepid. threepidcreds: %r" % (threepidCreds,))
|
logger.info("Getting validated threepid. threepidcreds: %r" % (threepid_creds,))
|
||||||
threepid = yield identity_handler.threepid_from_creds(threepidCreds)
|
threepid = yield identity_handler.threepid_from_creds(threepid_creds)
|
||||||
|
|
||||||
if not threepid:
|
if not threepid:
|
||||||
raise LoginError(401, "", errcode=Codes.UNAUTHORIZED)
|
raise LoginError(401, "", errcode=Codes.UNAUTHORIZED)
|
||||||
|
|
||||||
threepid['threepidCreds'] = authdict['threepidCreds']
|
threepid['threepid_creds'] = authdict['threepid_creds']
|
||||||
|
|
||||||
defer.returnValue(threepid)
|
defer.returnValue(threepid)
|
||||||
|
|
||||||
|
@ -44,19 +44,19 @@ class IdentityHandler(BaseHandler):
|
|||||||
# XXX: make this configurable!
|
# XXX: make this configurable!
|
||||||
# trustedIdServers = ['matrix.org', 'localhost:8090']
|
# trustedIdServers = ['matrix.org', 'localhost:8090']
|
||||||
trustedIdServers = ['matrix.org']
|
trustedIdServers = ['matrix.org']
|
||||||
if not creds['idServer'] in trustedIdServers:
|
if not creds['id_server'] in trustedIdServers:
|
||||||
logger.warn('%s is not a trusted ID server: rejecting 3pid ' +
|
logger.warn('%s is not a trusted ID server: rejecting 3pid ' +
|
||||||
'credentials', creds['idServer'])
|
'credentials', creds['id_server'])
|
||||||
defer.returnValue(None)
|
defer.returnValue(None)
|
||||||
|
|
||||||
data = {}
|
data = {}
|
||||||
try:
|
try:
|
||||||
data = yield http_client.get_json(
|
data = yield http_client.get_json(
|
||||||
"http://%s%s" % (
|
"http://%s%s" % (
|
||||||
creds['idServer'],
|
creds['id_server'],
|
||||||
"/_matrix/identity/api/v1/3pid/getValidated3pid"
|
"/_matrix/identity/api/v1/3pid/getValidated3pid"
|
||||||
),
|
),
|
||||||
{'sid': creds['sid'], 'clientSecret': creds['clientSecret']}
|
{'sid': creds['sid'], 'client_secret': creds['client_secret']}
|
||||||
)
|
)
|
||||||
except CodeMessageException as e:
|
except CodeMessageException as e:
|
||||||
data = json.loads(e.msg)
|
data = json.loads(e.msg)
|
||||||
@ -75,11 +75,11 @@ class IdentityHandler(BaseHandler):
|
|||||||
data = yield http_client.post_urlencoded_get_json(
|
data = yield http_client.post_urlencoded_get_json(
|
||||||
# XXX: Change when ID servers are all HTTPS
|
# XXX: Change when ID servers are all HTTPS
|
||||||
"http://%s%s" % (
|
"http://%s%s" % (
|
||||||
creds['idServer'], "/_matrix/identity/api/v1/3pid/bind"
|
creds['id_server'], "/_matrix/identity/api/v1/3pid/bind"
|
||||||
),
|
),
|
||||||
{
|
{
|
||||||
'sid': creds['sid'],
|
'sid': creds['sid'],
|
||||||
'clientSecret': creds['clientSecret'],
|
'client_secret': creds['client_secret'],
|
||||||
'mxid': mxid,
|
'mxid': mxid,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -136,11 +136,11 @@ class RegisterRestServlet(RestServlet):
|
|||||||
logger.info("bind_email specified: binding")
|
logger.info("bind_email specified: binding")
|
||||||
|
|
||||||
emailThreepid = result[LoginType.EMAIL_IDENTITY]
|
emailThreepid = result[LoginType.EMAIL_IDENTITY]
|
||||||
threepidCreds = emailThreepid['threepidCreds']
|
threepid_creds = emailThreepid['threepid_creds']
|
||||||
logger.debug("Binding emails %s to %s" % (
|
logger.debug("Binding emails %s to %s" % (
|
||||||
emailThreepid, user_id
|
emailThreepid, user_id
|
||||||
))
|
))
|
||||||
yield self.identity_handler.bind_threepid(threepidCreds, user_id)
|
yield self.identity_handler.bind_threepid(threepid_creds, user_id)
|
||||||
else:
|
else:
|
||||||
logger.info("bind_email not specified: not binding email")
|
logger.info("bind_email not specified: not binding email")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user