Software /
code /
prosody
Comparison
plugins/mod_c2s.lua @ 12907:d2333b468d07
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.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 23 Feb 2023 16:28:57 +0100 |
parent | 12808:12bd40b8e105 |
child | 12977:74b9e05af71e |
comparison
equal
deleted
inserted
replaced
12906:e282c92ded0e | 12907:d2333b468d07 |
---|---|
264 end | 264 end |
265 | 265 |
266 module:hook_global("user-password-changed", disconnect_user_sessions({ condition = "reset", text = "Password changed" }, true), 200); | 266 module:hook_global("user-password-changed", disconnect_user_sessions({ condition = "reset", text = "Password changed" }, true), 200); |
267 module:hook_global("user-role-changed", disconnect_user_sessions({ condition = "reset", text = "Role changed" }), 200); | 267 module:hook_global("user-role-changed", disconnect_user_sessions({ condition = "reset", text = "Role changed" }), 200); |
268 module:hook_global("user-deleted", disconnect_user_sessions({ condition = "not-authorized", text = "Account deleted" }), 200); | 268 module:hook_global("user-deleted", disconnect_user_sessions({ condition = "not-authorized", text = "Account deleted" }), 200); |
269 module:hook_global("user-disabled", disconnect_user_sessions({ condition = "not-authorized", text = "Account disabled" }), 200); | |
269 | 270 |
270 module:hook_global("c2s-session-updated", function (event) | 271 module:hook_global("c2s-session-updated", function (event) |
271 sessions[event.session.conn] = event.session; | 272 sessions[event.session.conn] = event.session; |
272 local replaced_conn = event.replaced_conn; | 273 local replaced_conn = event.replaced_conn; |
273 if replaced_conn then | 274 if replaced_conn then |