Diff

mod_log_sasl_mech/mod_log_sasl_mech.lua @ 5856:75dee6127829 draft

Merge upstream
author Trần H. Trung <xmpp:trần.h.trung@trung.fun>
date Tue, 06 Feb 2024 18:32:01 +0700
parent 5795:5ff8022466ab
line wrap: on
line diff
--- a/mod_log_sasl_mech/mod_log_sasl_mech.lua	Tue Aug 29 23:51:17 2023 +0700
+++ b/mod_log_sasl_mech/mod_log_sasl_mech.lua	Tue Feb 06 18:32:01 2024 +0700
@@ -1,6 +1,7 @@
 
 module:hook("authentication-success", function (event)
 	local session = event.session;
-	local sasl_handler = session.sasl_handler;
-	session.log("info", "Authenticated with %s", sasl_handler and sasl_handler.selected or "legacy auth");
+	local sasl_handler = session and session.sasl_handler;
+	local log = session and session.log or module._log
+	log("info", "Authenticated with %s", sasl_handler and sasl_handler.selected or "legacy auth");
 end);