From 1311ee4e56515df1b432827d129aceb4b2bba299 Mon Sep 17 00:00:00 2001
From: erikjohnston
False
, Synapse falls through to the next one. The value of the first
callback that does not return False
will be used. If this happens, Synapse will not call
any of the subsequent implementations of this callback.
+check_login_for_spam
First introduced in Synapse v1.87.0
+async def check_login_for_spam(
+ user_id: str,
+ device_id: Optional[str],
+ initial_display_name: Optional[str],
+ request_info: Collection[Tuple[Optional[str], str]],
+ auth_provider_id: Optional[str] = None,
+) -> Union["synapse.module_api.NOT_SPAM", "synapse.module_api.errors.Codes"]
+
+Called when a user logs in.
+The arguments passed to this callback are:
+user_id
: The user ID the user is logging in withdevice_id
: The device ID the user is re-logging into.initial_display_name
: The device display name, if any.request_info
: A collection of tuples, which first item is a user agent, and which
+second item is an IP address. These user agents and IP addresses are the ones that were
+used during the login process.auth_provider_id
: The identifier of the SSO authentication provider, if any.If multiple modules implement this callback, they will be considered in order. If a
+callback returns synapse.module_api.NOT_SPAM
, Synapse falls through to the next one.
+The value of the first callback that does not return synapse.module_api.NOT_SPAM
will
+be used. If this happens, Synapse will not call any of the subsequent implementations of
+this callback.
Note: This will not be called when a user registers.
The example below is a module that implements the spam checker callback
check_event_for_spam
to deny any message sent by users whose Matrix user IDs are
--
cgit 1.5.1