Merge pull request #2629 from matrix-org/rav/register_inhibit_login

support inhibit_login in /register
This commit is contained in:
David Baker 2017-11-02 16:51:35 +00:00 committed by GitHub
commit 9e09a1800b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -557,10 +557,15 @@ class RegisterRestServlet(RestServlet):
Args: Args:
(str) user_id: full canonical @user:id (str) user_id: full canonical @user:id
(object) params: registration parameters, from which we pull (object) params: registration parameters, from which we pull
device_id and initial_device_name device_id, initial_device_name and inhibit_login
Returns: Returns:
defer.Deferred: (object) dictionary for response from /register defer.Deferred: (object) dictionary for response from /register
""" """
result = {
"user_id": user_id,
"home_server": self.hs.hostname,
}
if not params.get("inhibit_login", False):
device_id = yield self._register_device(user_id, params) device_id = yield self._register_device(user_id, params)
access_token = ( access_token = (
@ -569,12 +574,11 @@ class RegisterRestServlet(RestServlet):
) )
) )
defer.returnValue({ result.update({
"user_id": user_id,
"access_token": access_token, "access_token": access_token,
"home_server": self.hs.hostname,
"device_id": device_id, "device_id": device_id,
}) })
defer.returnValue(result)
def _register_device(self, user_id, params): def _register_device(self, user_id, params):
"""Register a device for a user. """Register a device for a user.