summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-03-18 11:38:52 +0000
committerErik Johnston <erik@matrix.org>2015-03-18 11:38:52 +0000
commited4d44d833f671758456be421660029aee3778cd (patch)
tree563bb423551f8c264907b06cac6053f44cbfabf6 /synapse/handlers
parentClean out event_forward_extremities table when the server rejoins the room (diff)
parentFactor out user id validation checks (diff)
downloadsynapse-ed4d44d833f671758456be421660029aee3778cd.tar.xz
Merge pull request #109 from matrix-org/default_registration
Disable registration by default. Add script to register new users. 
Diffstat (limited to 'synapse/handlers')
-rw-r--r--synapse/handlers/register.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/synapse/handlers/register.py b/synapse/handlers/register.py
index cda4a8502a..c25e321099 100644
--- a/synapse/handlers/register.py
+++ b/synapse/handlers/register.py
@@ -31,6 +31,7 @@ import base64
 import bcrypt
 import json
 import logging
+import urllib
 
 logger = logging.getLogger(__name__)
 
@@ -63,6 +64,13 @@ class RegistrationHandler(BaseHandler):
             password_hash = bcrypt.hashpw(password, bcrypt.gensalt())
 
         if localpart:
+            if localpart and urllib.quote(localpart) != localpart:
+                raise SynapseError(
+                    400,
+                    "User ID must only contain characters which do not"
+                    " require URL encoding."
+                )
+
             user = UserID(localpart, self.hs.hostname)
             user_id = user.to_string()