mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-16 13:02:32 -04:00
Add a module type for account validity (#9884)
This adds an API for third-party plugin modules to implement account validity, so they can provide this feature instead of Synapse. The module implementing the current behaviour for this feature can be found at https://github.com/matrix-org/synapse-email-account-validity. To allow for a smooth transition between the current feature and the new module, hooks have been added to the existing account validity endpoints to allow their behaviours to be overridden by a module.
This commit is contained in:
parent
d427f64724
commit
36dc15412d
13 changed files with 438 additions and 228 deletions
|
@ -77,6 +77,7 @@ class RegistrationHandler(BaseHandler):
|
|||
self.identity_handler = self.hs.get_identity_handler()
|
||||
self.ratelimiter = hs.get_registration_ratelimiter()
|
||||
self.macaroon_gen = hs.get_macaroon_generator()
|
||||
self._account_validity_handler = hs.get_account_validity_handler()
|
||||
self._server_notices_mxid = hs.config.server_notices_mxid
|
||||
self._server_name = hs.hostname
|
||||
|
||||
|
@ -700,6 +701,10 @@ class RegistrationHandler(BaseHandler):
|
|||
shadow_banned=shadow_banned,
|
||||
)
|
||||
|
||||
# Only call the account validity module(s) on the main process, to avoid
|
||||
# repeating e.g. database writes on all of the workers.
|
||||
await self._account_validity_handler.on_user_registration(user_id)
|
||||
|
||||
async def register_device(
|
||||
self,
|
||||
user_id: str,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue