diff options
author | David Baker <dbkr@users.noreply.github.com> | 2017-11-02 16:51:35 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-02 16:51:35 +0000 |
commit | 9e09a1800b6f1afd3b965535fcdd56bc5fe73e62 (patch) | |
tree | dc77cafc6c93fd14e3fecd110ea25eca2933ead6 /synapse/rest | |
parent | Merge pull request #2628 from matrix-org/rav/module_api_hooks (diff) | |
parent | support inhibit_login in /register (diff) | |
download | synapse-9e09a1800b6f1afd3b965535fcdd56bc5fe73e62.tar.xz |
Merge pull request #2629 from matrix-org/rav/register_inhibit_login
support inhibit_login in /register
Diffstat (limited to 'synapse/rest')
-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. |