diff options
author | Erik Johnston <erik@matrix.org> | 2015-03-18 11:33:46 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-03-18 11:34:18 +0000 |
commit | f88db7ac0bc36974240db869606634b817471842 (patch) | |
tree | cdf1ba8ed785b6a53b2cc9de158bdfb429600737 /synapse/rest/client/v1/register.py | |
parent | Do more validation of incoming request (diff) | |
download | synapse-f88db7ac0bc36974240db869606634b817471842.tar.xz |
Factor out user id validation checks
Diffstat (limited to 'synapse/rest/client/v1/register.py')
-rw-r--r-- | synapse/rest/client/v1/register.py | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/synapse/rest/client/v1/register.py b/synapse/rest/client/v1/register.py index ccc457924b..a56834e365 100644 --- a/synapse/rest/client/v1/register.py +++ b/synapse/rest/client/v1/register.py @@ -27,7 +27,6 @@ from hashlib import sha1 import hmac import simplejson as json import logging -import urllib logger = logging.getLogger(__name__) @@ -263,14 +262,11 @@ class RegisterRestServlet(ClientV1RestServlet): ) password = register_json["password"].encode("utf-8") - desired_user_id = (register_json["user"].encode("utf-8") - if "user" in register_json else None) - if (desired_user_id - and urllib.quote(desired_user_id) != desired_user_id): - raise SynapseError( - 400, - "User ID must only contain characters which do not " + - "require URL encoding.") + desired_user_id = ( + register_json["user"].encode("utf-8") + if "user" in register_json else None + ) + handler = self.handlers.registration_handler (user_id, token) = yield handler.register( localpart=desired_user_id, |