mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-12-25 12:09:21 -05:00
support inhibit_login in /register
Allow things to pass inhibit_login when registering to ... inhibit logins.
This commit is contained in:
parent
b19d9e2174
commit
6c3a02072b
@ -557,24 +557,28 @@ 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
|
||||||
"""
|
"""
|
||||||
device_id = yield self._register_device(user_id, params)
|
result = {
|
||||||
|
|
||||||
access_token = (
|
|
||||||
yield self.auth_handler.get_access_token_for_user_id(
|
|
||||||
user_id, device_id=device_id,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
defer.returnValue({
|
|
||||||
"user_id": user_id,
|
"user_id": user_id,
|
||||||
"access_token": access_token,
|
|
||||||
"home_server": self.hs.hostname,
|
"home_server": self.hs.hostname,
|
||||||
"device_id": device_id,
|
}
|
||||||
})
|
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,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
result.update({
|
||||||
|
"access_token": access_token,
|
||||||
|
"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.
|
||||||
|
Loading…
Reference in New Issue
Block a user