diff options
author | Richard van der Hoff <richard@matrix.org> | 2017-11-02 16:31:07 +0000 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2017-11-02 16:31:07 +0000 |
commit | 6c3a02072b8c5b4694e91bf597dbf14ac3d81cea (patch) | |
tree | 5fdb41c0265ef289054918f14b95fa83dc0d9d02 | |
parent | Merge pull request #2624 from matrix-org/rav/password_provider_notify_logout (diff) | |
download | synapse-6c3a02072b8c5b4694e91bf597dbf14ac3d81cea.tar.xz |
support inhibit_login in /register
Allow things to pass inhibit_login when registering to ... inhibit logins.
-rw-r--r-- | synapse/rest/client/v2_alpha/register.py | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/synapse/rest/client/v2_alpha/register.py b/synapse/rest/client/v2_alpha/register.py index a077146c89..eebd071e59 100644 --- a/synapse/rest/client/v2_alpha/register.py +++ b/synapse/rest/client/v2_alpha/register.py @@ -557,24 +557,28 @@ class RegisterRestServlet(RestServlet): Args: (str) user_id: full canonical @user:id (object) params: registration parameters, from which we pull - device_id and initial_device_name + device_id, initial_device_name and inhibit_login Returns: defer.Deferred: (object) dictionary for response from /register """ - device_id = yield self._register_device(user_id, params) + 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) - access_token = ( - yield self.auth_handler.get_access_token_for_user_id( - user_id, device_id=device_id, + access_token = ( + yield self.auth_handler.get_access_token_for_user_id( + user_id, device_id=device_id, + ) ) - ) - defer.returnValue({ - "user_id": user_id, - "access_token": access_token, - "home_server": self.hs.hostname, - "device_id": device_id, - }) + result.update({ + "access_token": access_token, + "device_id": device_id, + }) + defer.returnValue(result) def _register_device(self, user_id, params): """Register a device for a user. |