mirror of
https://mau.dev/maunium/synapse.git
synced 2024-10-01 01:36:05 -04:00
special case msisdns when deriving mxids from 3pids
This commit is contained in:
parent
32e4420a66
commit
2992125561
@ -384,13 +384,8 @@ class RegisterRestServlet(RestServlet):
|
|||||||
# desired_username
|
# desired_username
|
||||||
if auth_result:
|
if auth_result:
|
||||||
if (
|
if (
|
||||||
(
|
self.hs.config.register_mxid_from_3pid == 'email' and
|
||||||
self.hs.config.register_mxid_from_3pid == 'email' and
|
LoginType.EMAIL_IDENTITY in auth_result
|
||||||
LoginType.EMAIL_IDENTITY in auth_result
|
|
||||||
) or (
|
|
||||||
self.hs.config.register_mxid_from_3pid == 'msisdn' and
|
|
||||||
LoginType.MSISDN in auth_result
|
|
||||||
)
|
|
||||||
):
|
):
|
||||||
address = auth_result[login_type]['address']
|
address = auth_result[login_type]['address']
|
||||||
desired_username = types.strip_invalid_mxid_characters(
|
desired_username = types.strip_invalid_mxid_characters(
|
||||||
@ -428,6 +423,15 @@ class RegisterRestServlet(RestServlet):
|
|||||||
capwords(parts[0]) +
|
capwords(parts[0]) +
|
||||||
" [" + capwords(parts[1].split(' ')[0]) + "]"
|
" [" + capwords(parts[1].split(' ')[0]) + "]"
|
||||||
)
|
)
|
||||||
|
elif (
|
||||||
|
self.hs.config.register_mxid_from_3pid == 'msisdn' and
|
||||||
|
LoginType.MSISDN in auth_result
|
||||||
|
):
|
||||||
|
desired_username = auth_result[login_type]['address']
|
||||||
|
else:
|
||||||
|
raise SynapseError(
|
||||||
|
400, "Cannot derive mxid from 3pid; no recognised 3pid"
|
||||||
|
)
|
||||||
|
|
||||||
if desired_username is not None:
|
if desired_username is not None:
|
||||||
yield self.registration_handler.check_username(
|
yield self.registration_handler.check_username(
|
||||||
|
Loading…
Reference in New Issue
Block a user