summary refs log tree commit diff
path: root/synapse/module_api
diff options
context:
space:
mode:
authorAndrew Morgan <1342360+anoadragon453@users.noreply.github.com>2019-03-26 17:48:30 +0000
committerGitHub <noreply@github.com>2019-03-26 17:48:30 +0000
commitbbd244c7b202319f7642f151e099761024327fa2 (patch)
tree82d41828c5c4ee06f3e129730559eb242a29f836 /synapse/module_api
parentUse the state event amount for userdir import batching, not room count (#4944) (diff)
downloadsynapse-bbd244c7b202319f7642f151e099761024327fa2.tar.xz
Support 3PID login in password providers (#4931)
Adds a new method, check_3pid_auth, which gives password providers
the chance to allow authentication with third-party identifiers such
as email or msisdn.
Diffstat (limited to 'synapse/module_api')
-rw-r--r--synapse/module_api/__init__.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/synapse/module_api/__init__.py b/synapse/module_api/__init__.py

index fc9a20ff59..235ce8334e 100644 --- a/synapse/module_api/__init__.py +++ b/synapse/module_api/__init__.py
@@ -73,14 +73,26 @@ class ModuleApi(object): """ return self._auth_handler.check_user_exists(user_id) - def register(self, localpart): - """Registers a new user with given localpart + @defer.inlineCallbacks + def register(self, localpart, displayname=None): + """Registers a new user with given localpart and optional + displayname. + + Args: + localpart (str): The localpart of the new user. + displayname (str|None): The displayname of the new user. If None, + the user's displayname will default to `localpart`. Returns: Deferred: a 2-tuple of (user_id, access_token) """ + # Register the user reg = self.hs.get_registration_handler() - return reg.register(localpart=localpart) + user_id, access_token = yield reg.register( + localpart=localpart, default_display_name=displayname, + ) + + defer.returnValue((user_id, access_token)) @defer.inlineCallbacks def invalidate_access_token(self, access_token):