Merge pull request #513 from matrix-org/erikj/register_user_chars
Don't explode when given a unicode username in /register/
This commit is contained in:
commit
d049e81b10
|
@ -49,11 +49,10 @@ class RegistrationHandler(BaseHandler):
|
||||||
def check_username(self, localpart, guest_access_token=None):
|
def check_username(self, localpart, guest_access_token=None):
|
||||||
yield run_on_reactor()
|
yield run_on_reactor()
|
||||||
|
|
||||||
if urllib.quote(localpart) != localpart:
|
if urllib.quote(localpart.encode('utf-8')) != localpart:
|
||||||
raise SynapseError(
|
raise SynapseError(
|
||||||
400,
|
400,
|
||||||
"User ID must only contain characters which do not"
|
"User ID can only contain characters a-z, 0-9, or '-./'",
|
||||||
" require URL encoding.",
|
|
||||||
Codes.INVALID_USERNAME
|
Codes.INVALID_USERNAME
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue