diff options
author | Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> | 2019-03-28 15:48:07 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-28 15:48:07 +0000 |
commit | 7a91b9d81c8ef84ce3aff785f9e2fc0a8268df1f (patch) | |
tree | 05a2b0e07dda8663ef0c37c31895a094aa7254a5 /synapse/module_api/__init__.py | |
parent | Merge pull request #4942 from matrix-org/erikj/fix_presence (diff) | |
download | synapse-7a91b9d81c8ef84ce3aff785f9e2fc0a8268df1f.tar.xz |
Allow password providers to bind emails (#4947)
This PR allows password provider modules to bind email addresses when a user is registering and is motivated by matrix-org/matrix-synapse-ldap3#58
Diffstat (limited to 'synapse/module_api/__init__.py')
-rw-r--r-- | synapse/module_api/__init__.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/synapse/module_api/__init__.py b/synapse/module_api/__init__.py index 235ce8334e..b3abd1b3c6 100644 --- a/synapse/module_api/__init__.py +++ b/synapse/module_api/__init__.py @@ -74,14 +74,14 @@ class ModuleApi(object): return self._auth_handler.check_user_exists(user_id) @defer.inlineCallbacks - def register(self, localpart, displayname=None): + def register(self, localpart, displayname=None, emails=[]): """Registers a new user with given localpart and optional - displayname. + displayname, emails. 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`. + displayname (str|None): The displayname of the new user. + emails (List[str]): Emails to bind to the new user. Returns: Deferred: a 2-tuple of (user_id, access_token) @@ -90,6 +90,7 @@ class ModuleApi(object): reg = self.hs.get_registration_handler() user_id, access_token = yield reg.register( localpart=localpart, default_display_name=displayname, + bind_emails=emails, ) defer.returnValue((user_id, access_token)) |