summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-01-21 09:53:35 +0000
committerErik Johnston <erik@matrix.org>2016-01-21 09:53:35 +0000
commitd049e81b10949f07ee524cd6096bcb8715e5531c (patch)
tree542ae5ef0033017b130a6381bdaf95408c6c41f9
parentFix change_password (diff)
parentDon't explode when given a unicode username in /register/ (diff)
downloadsynapse-d049e81b10949f07ee524cd6096bcb8715e5531c.tar.xz
Merge pull request #513 from matrix-org/erikj/register_user_chars
Don't explode when given a unicode username in /register/
-rw-r--r--synapse/handlers/register.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/synapse/handlers/register.py b/synapse/handlers/register.py
index 8e601b052b..1e99c1303c 100644
--- a/synapse/handlers/register.py
+++ b/synapse/handlers/register.py
@@ -49,11 +49,10 @@ class RegistrationHandler(BaseHandler):
     def check_username(self, localpart, guest_access_token=None):
         yield run_on_reactor()
 
-        if urllib.quote(localpart) != localpart:
+        if urllib.quote(localpart.encode('utf-8')) != localpart:
             raise SynapseError(
                 400,
-                "User ID must only contain characters which do not"
-                " require URL encoding.",
+                "User ID can only contain characters a-z, 0-9, or '-./'",
                 Codes.INVALID_USERNAME
             )