diff options
author | Richard van der Hoff <richard@matrix.org> | 2017-11-09 22:20:01 +0000 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2017-11-09 22:20:01 +0000 |
commit | 9b599bc18d844208b94219e7aa23c6157bae3b00 (patch) | |
tree | 7d7ad87a2f0651f62ea8a85f7222adca0d482efb /synapse/rest/client/v2_alpha | |
parent | Revert "Allow upper-case characters in mxids" (diff) | |
download | synapse-9b599bc18d844208b94219e7aa23c6157bae3b00.tar.xz |
Downcase userid on registration
Force username to lowercase before attempting to register https://github.com/matrix-org/synapse/issues/2660
Diffstat (limited to 'synapse/rest/client/v2_alpha')
-rw-r--r-- | synapse/rest/client/v2_alpha/register.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/synapse/rest/client/v2_alpha/register.py b/synapse/rest/client/v2_alpha/register.py index eebd071e59..884edde119 100644 --- a/synapse/rest/client/v2_alpha/register.py +++ b/synapse/rest/client/v2_alpha/register.py @@ -224,6 +224,9 @@ class RegisterRestServlet(RestServlet): # 'user' key not 'username'). Since this is a new addition, we'll # fallback to 'username' if they gave one. desired_username = body.get("user", desired_username) + + # XXX we should check that desired_username is valid + access_token = get_access_token_from_request(request) if isinstance(desired_username, basestring): @@ -273,7 +276,7 @@ class RegisterRestServlet(RestServlet): if desired_username is not None: yield self.registration_handler.check_username( - desired_username, + desired_username.lower(), guest_access_token=guest_access_token, assigned_user_id=registered_user_id, ) @@ -336,6 +339,9 @@ class RegisterRestServlet(RestServlet): new_password = params.get("password", None) guest_access_token = params.get("guest_access_token", None) + if desired_username is not None: + desired_username = desired_username.lower() + (registered_user_id, _) = yield self.registration_handler.register( localpart=desired_username, password=new_password, |