Diff

plugins/mod_c2s.lua @ 8201:a0ad62a269df

Merge 0.10->trunk
author Kim Alvefur <zash@zash.se>
date Mon, 28 Aug 2017 21:05:12 +0200
parent 8044:e38e3300b955
parent 8192:4354f556c5db
child 8235:7d9a2c200736
line wrap: on
line diff
--- a/plugins/mod_c2s.lua	Fri Jul 28 23:47:38 2017 +0100
+++ b/plugins/mod_c2s.lua	Mon Aug 28 21:05:12 2017 +0200
@@ -201,6 +201,18 @@
 	end
 end, 200);
 
+module:hook_global("user-password-changed", function(event)
+	local username, host, resource = event.username, event.host, event.resource;
+	local user = hosts[host].sessions[username];
+	if user and user.sessions then
+		for r, session in pairs(user.sessions) do
+			if r ~= resource then
+				session:close{ condition = "reset", text = "Password changed" };
+			end
+		end
+	end
+end, 200);
+
 function runner_callbacks:ready()
 	self.data.conn:resume();
 end