mod_c2s: Disconnect accounts when they are disabled
authorKim Alvefur <zash@zash.se>
Thu, 23 Feb 2023 16:28:57 +0100
changeset 12911 d2333b468d07
parent 12910 e282c92ded0e
child 12912 e96c3ea64996
mod_c2s: Disconnect accounts when they are disabled We decided that at the first stage, accounts that are disabled should simply be prevented from authenticating, thus they should also be prevented from having connected sessions. Since this is aimed to be a moderation action for cases of abuse, they shouldn't be allowed to continue being connected.
plugins/mod_c2s.lua
--- a/plugins/mod_c2s.lua	Thu Feb 23 16:25:31 2023 +0100
+++ b/plugins/mod_c2s.lua	Thu Feb 23 16:28:57 2023 +0100
@@ -266,6 +266,7 @@
 module:hook_global("user-password-changed", disconnect_user_sessions({ condition = "reset", text = "Password changed" }, true), 200);
 module:hook_global("user-role-changed", disconnect_user_sessions({ condition = "reset", text = "Role changed" }), 200);
 module:hook_global("user-deleted", disconnect_user_sessions({ condition = "not-authorized", text = "Account deleted" }), 200);
+module:hook_global("user-disabled", disconnect_user_sessions({ condition = "not-authorized", text = "Account disabled" }), 200);
 
 module:hook_global("c2s-session-updated", function (event)
 	sessions[event.session.conn] = event.session;