summary refs log tree commit diff
path: root/synapse/rest
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@matrix.org>2018-04-12 18:30:32 +0100
committerMatthew Hodgson <matthew@matrix.org>2018-04-12 18:30:32 +0100
commit240e940c3fcc59e331f3af2b4b14b26741e9c3b1 (patch)
treecd7c7bb7fb18eefdc8c153122898a7e0e66443f5 /synapse/rest
parentadd the register_mxid_from_3pid setting (untested) (diff)
downloadsynapse-240e940c3fcc59e331f3af2b4b14b26741e9c3b1.tar.xz
handle medium checks correctly
Diffstat (limited to 'synapse/rest')
-rw-r--r--synapse/rest/client/v2_alpha/register.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/synapse/rest/client/v2_alpha/register.py b/synapse/rest/client/v2_alpha/register.py

index 8c64229cfc..41a13ece7f 100644 --- a/synapse/rest/client/v2_alpha/register.py +++ b/synapse/rest/client/v2_alpha/register.py
@@ -377,9 +377,18 @@ class RegisterRestServlet(RestServlet): # we should always have an auth_result if we're going to progress # to register the user (i.e. we haven't picked up a registered_user_id) # from our session store - if auth_result and self.hs.config.register_mxid_from_3pid in auth_result: - address = auth_result[login_type]['address'] - desired_username = address.lower() + 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 + ) + ): + address = auth_result[login_type]['address'] + desired_username = address.replace('@', '.').lower() if desired_username is not None: yield self.registration_handler.check_username(