Require deprecated medium parameter to be 'email'

This commit is contained in:
Andrew Morgan 2020-05-28 16:58:43 +01:00
parent 5cb470b495
commit f457eedc87

View file

@ -43,6 +43,12 @@ def login_submission_legacy_convert(submission):
del submission["user"]
if "medium" in submission and "address" in submission:
# "email" is the only accepted medium type
if submission["medium"] != "email":
raise SynapseError(
400, "'medium' parameter must be 'email'", errcode=Codes.INVALID_PARAM
)
submission["identifier"] = {
"type": "m.id.thirdparty",
"medium": submission["medium"],