mirror of
https://github.com/element-hq/synapse.git
synced 2024-12-19 01:21:09 +03:00
special case msisdns when deriving mxids from 3pids
This commit is contained in:
parent
32e4420a66
commit
2992125561
1 changed files with 11 additions and 7 deletions
|
@ -384,13 +384,8 @@ class RegisterRestServlet(RestServlet):
|
|||
# desired_username
|
||||
if auth_result:
|
||||
if (
|
||||
(
|
||||
self.hs.config.register_mxid_from_3pid == 'email' and
|
||||
LoginType.EMAIL_IDENTITY in auth_result
|
||||
) or (
|
||||
self.hs.config.register_mxid_from_3pid == 'msisdn' and
|
||||
LoginType.MSISDN in auth_result
|
||||
)
|
||||
self.hs.config.register_mxid_from_3pid == 'email' and
|
||||
LoginType.EMAIL_IDENTITY in auth_result
|
||||
):
|
||||
address = auth_result[login_type]['address']
|
||||
desired_username = types.strip_invalid_mxid_characters(
|
||||
|
@ -428,6 +423,15 @@ class RegisterRestServlet(RestServlet):
|
|||
capwords(parts[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:
|
||||
yield self.registration_handler.check_username(
|
||||
|
|
Loading…
Reference in a new issue