mirror of
https://github.com/element-hq/synapse
synced 2024-09-12 03:35:10 +00:00
Check absent before trying to access keys
This commit is contained in:
parent
73605f8070
commit
f43041aacd
1 changed files with 3 additions and 3 deletions
|
@ -224,6 +224,9 @@ class RegisterRestServlet(RestServlet):
|
||||||
if k not in body:
|
if k not in body:
|
||||||
absent.append(k)
|
absent.append(k)
|
||||||
|
|
||||||
|
if len(absent) > 0:
|
||||||
|
raise SynapseError(400, "Missing params: %r" % absent, Codes.MISSING_PARAM)
|
||||||
|
|
||||||
existingUid = yield self.hs.get_datastore().get_user_id_by_threepid(
|
existingUid = yield self.hs.get_datastore().get_user_id_by_threepid(
|
||||||
'email', body['email']
|
'email', body['email']
|
||||||
)
|
)
|
||||||
|
@ -231,9 +234,6 @@ class RegisterRestServlet(RestServlet):
|
||||||
if existingUid is not None:
|
if existingUid is not None:
|
||||||
raise SynapseError(400, "Email is already in use", Codes.THREEPID_IN_USE)
|
raise SynapseError(400, "Email is already in use", Codes.THREEPID_IN_USE)
|
||||||
|
|
||||||
if len(absent) > 0:
|
|
||||||
raise SynapseError(400, "Missing params: %r" % absent, Codes.MISSING_PARAM)
|
|
||||||
|
|
||||||
ret = yield self.identity_handler.requestEmailToken(**body)
|
ret = yield self.identity_handler.requestEmailToken(**body)
|
||||||
defer.returnValue((200, ret))
|
defer.returnValue((200, ret))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue