Use body.get to check for 'user'

This commit is contained in:
Will Hunt 2016-07-16 18:37:34 +01:00
parent e885e2a623
commit 511a52afc8
1 changed files with 1 additions and 2 deletions

View File

@ -132,8 +132,7 @@ class RegisterRestServlet(RestServlet):
# Set the desired user according to the AS API (which uses the # Set the desired user according to the AS API (which uses the
# 'user' key not 'username'). Since this is a new addition, we'll # 'user' key not 'username'). Since this is a new addition, we'll
# fallback to 'username' if they gave one. # fallback to 'username' if they gave one.
if isinstance(body.get("user"), basestring): desired_username = body.get("user", desired_username)
desired_username = body["user"]
if isinstance(desired_username, basestring): if isinstance(desired_username, basestring):
result = yield self._do_appservice_registration( result = yield self._do_appservice_registration(