changeset 5249:828e5e443613

mod_sasl2: Fire authentication-{success,failure} events like mod_saslauth
author Matthew Wild <mwild1@gmail.com>
date Tue, 14 Mar 2023 17:13:46 +0000
parents b8b2bf0c1b4b
children d9577083c5f5
files mod_sasl2/mod_sasl2.lua
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_sasl2/mod_sasl2.lua	Tue Mar 14 18:08:25 2023 +0100
+++ b/mod_sasl2/mod_sasl2.lua	Tue Mar 14 17:13:46 2023 +0000
@@ -121,6 +121,7 @@
 end
 
 module:hook("sasl2/c2s/failure", function (event)
+	module:fire_event("authentication-failure", event);
 	local session, condition, text = event.session, event.message, event.error_text;
 	local failure = st.stanza("failure", { xmlns = xmlns_sasl2 })
 		:tag(condition, { xmlns = "urn:ietf:params:xml:ns:xmpp-sasl" }):up();
@@ -165,6 +166,7 @@
 end, -1000);
 
 module:hook("sasl2/c2s/success", function (event)
+	module:fire_event("authentication-success", event);
 	local session = event.session;
 	local features = st.stanza("stream:features");
 	module:fire_event("stream-features", { origin = session, features = features });