password -> account servlet and add start of an 'add 3pid' endpoint

This commit is contained in:
David Baker 2015-04-17 13:44:12 +01:00
parent 83b554437e
commit 94e1e58b4d
2 changed files with 17 additions and 2 deletions

View File

@ -16,7 +16,7 @@
from . import (
sync,
filter,
password,
account,
register,
auth
)
@ -35,6 +35,6 @@ class ClientV2AlphaRestResource(JsonResource):
def register_servlets(client_resource, hs):
sync.register_servlets(hs, client_resource)
filter.register_servlets(hs, client_resource)
password.register_servlets(hs, client_resource)
account.register_servlets(hs, client_resource)
register.register_servlets(hs, client_resource)
auth.register_servlets(hs, client_resource)

View File

@ -75,5 +75,20 @@ class PasswordRestServlet(RestServlet):
return 200, {}
class AddThreepidRestServlet(RestServlet):
PATTERN = client_v2_pattern("/account/3pid")
@defer.inlineCallbacks
def on_POST(self, request):
body = parse_json_dict_from_request(request)
if 'threePidCreds' not in body:
raise SynapseError(400, "Missing param", Codes.MISSING_PARAM)
auth_user, client = yield self.auth.get_user_by_req(request)
def register_servlets(hs, http_server):
PasswordRestServlet(hs).register(http_server)