mirror of
https://mau.dev/maunium/synapse.git
synced 2024-08-23 10:45:48 +00:00
Add app service auth back in to v2 register
This commit is contained in:
parent
6b59650753
commit
4eb6d66b45
@ -59,13 +59,11 @@ class LoginType(object):
|
|||||||
EMAIL_URL = u"m.login.email.url"
|
EMAIL_URL = u"m.login.email.url"
|
||||||
EMAIL_IDENTITY = u"m.login.email.identity"
|
EMAIL_IDENTITY = u"m.login.email.identity"
|
||||||
RECAPTCHA = u"m.login.recaptcha"
|
RECAPTCHA = u"m.login.recaptcha"
|
||||||
APPLICATION_SERVICE = u"m.login.application_service"
|
|
||||||
|
|
||||||
# Only for C/S API v1
|
# Only for C/S API v1
|
||||||
|
APPLICATION_SERVICE = u"m.login.application_service"
|
||||||
SHARED_SECRET = u"org.matrix.login.shared_secret"
|
SHARED_SECRET = u"org.matrix.login.shared_secret"
|
||||||
|
|
||||||
HIDDEN_TYPES = [APPLICATION_SERVICE]
|
|
||||||
|
|
||||||
|
|
||||||
class EventTypes(object):
|
class EventTypes(object):
|
||||||
Member = "m.room.member"
|
Member = "m.room.member"
|
||||||
|
@ -59,7 +59,13 @@ class RegisterRestServlet(RestServlet):
|
|||||||
is_using_shared_secret = False
|
is_using_shared_secret = False
|
||||||
is_application_server = False
|
is_application_server = False
|
||||||
|
|
||||||
if 'mac' in body:
|
service = None
|
||||||
|
if 'access_token' in request.args:
|
||||||
|
service = yield self.auth.get_appservice_by_req(request)
|
||||||
|
|
||||||
|
if service:
|
||||||
|
is_application_server = True
|
||||||
|
elif 'mac' in body:
|
||||||
# Check registration-specific shared secret auth
|
# Check registration-specific shared secret auth
|
||||||
if 'username' not in body:
|
if 'username' not in body:
|
||||||
raise SynapseError(400, "", Codes.MISSING_PARAM)
|
raise SynapseError(400, "", Codes.MISSING_PARAM)
|
||||||
@ -71,7 +77,6 @@ class RegisterRestServlet(RestServlet):
|
|||||||
authed, result = yield self.auth_handler.check_auth([
|
authed, result = yield self.auth_handler.check_auth([
|
||||||
[LoginType.RECAPTCHA],
|
[LoginType.RECAPTCHA],
|
||||||
[LoginType.EMAIL_IDENTITY, LoginType.RECAPTCHA],
|
[LoginType.EMAIL_IDENTITY, LoginType.RECAPTCHA],
|
||||||
[LoginType.APPLICATION_SERVICE]
|
|
||||||
], body, self.hs.get_ip_from_request(request))
|
], body, self.hs.get_ip_from_request(request))
|
||||||
|
|
||||||
if not authed:
|
if not authed:
|
||||||
|
Loading…
Reference in New Issue
Block a user